Our Customers
Contact Us Email: support@barcodelib.com
Home > .NET RDLC Reports Barcode > Barcode Generation Guide > VB.NET Barcode Library for RDLC Reports
Download Barcode for RDLC Reports Trial

How to Create Barcodes in .NET RDLC Local Reports using VB.NET

Prerequisites
  • BarcodeLib.Barcode.RDLCReports.dll
  • Microsoft .NET Framework 2.0 (or later)
  • SQL Server 2005 (any edition) with AdventureWorks Database installed
  • Microsoft Visual Studio 2005 or later version
Create Barcode Image in RDLC Reports for ASP.NET using VB.NET
BarcodeLib RDLC Report Barcode Generator supports barcode image printing in RDL Reports for ASP.NET web applications using Visual Basic (VB.NET). Here is a brief barcoding guide for you. If you want to view more details, please navigate to how to print barcodes in RDLC Report for ASP.NET.
  1. Create a new ASP.NET Web Application Project.
  2. Add a new Class to the project and Add Reference.
    • Add a new item (Class), named "SampleClass.cs" to the project.
    • Add "BarcodeLib.Barcode.RDLCReports.dll" to the project reference.
    • Add the following sample code to your created class "APP_Code/SampleClass.cs".
    • In Visual Studio menu bar, choose "Build Web Site" from "Build" tab.
     Imports System.Collections.Generic
Imports BarcodeLib.Barcode.RDLCReports
Imports BarcodeLib.Barcode


Public Class SampleClass
Private m_description As String
Private m_price As Integer
Private m_bytes As Byte()

Public Sub New(description As String, price As Integer, data As String)
m_description = description
m_price = price
Dim barcode As New LinearRDLC()
barcode.Type = BarcodeType.CODE128
barcode.Data = data

barcode.LeftMargin = 0
barcode.RightMargin = 0
barcode.TopMargin = 0
barcode.BottomMargin = 0

' more barcode settings here

m_bytes = barcode.drawBarcodeAsBytes()
End Sub

Public ReadOnly Property Bytes() As Byte()
Get
Return m_bytes
End Get
End Property

Public ReadOnly Property Description() As String
Get
Return m_description
End Get
End Property

Public ReadOnly Property Price() As Integer
Get
Return m_price
End Get
End Property
End Class

Public Class Merchant
Private m_products As List(Of SampleClass)

Public Sub New()
m_products = New List(Of SampleClass)()
m_products.Add(New SampleClass("code128", 25, "code128"))
m_products.Add(New SampleClass("code39", 30, "code39"))
m_products.Add(New SampleClass("qrcode", 15, "qrcode"))
End Sub

Public Function GetProducts() As List(Of SampleClass)
Return m_products
End Function
End Class
3. Add a new Report to the web form.
4. Add a Report Viewer to the web form.
5. Resize the "ReportViewer", and run the project.
Create Barcode Image in RDLC Reports for .NET Windows Forms with VB.NET
BarcodeLib RDLC Report Barcode Generator can add barcoding functinality of printing barcodes in RDL Reports in .NET Windows applications using Visual C#. Below is a simplified tutorial, for more details, please view how to print barcodes in RDLC Report for .NET windows forms.
  1. Create a new Windows Application Project.
  2. Add a new DataSet to the project.
  3. Add a new Report to the window form.
  4. Add a Report Viewer to the window form.
    • Resize "Form1", and add "ReportViewer" to the form, with the default setting unchanged.
    • In "ReportViewer Tasks" window, choose your created report "BarcodeforRDLCReports.RDLCReports.rdlc".
    • Bind data collection: In Visual Studio menu bar, choose "Data Sources..." from "Report" tab.
    • Select "AdventureWorks.xsd_vProductAndDescription" as data sources. Click "Add to Report", then "OK" button.
    • Again, in "ReportViewer Tasks" window, choose "Rebind Data Sources".
    • Add "BarcodeLib.Barcode.RDLCReports.dll" to the project reference.
    • Add the following code to the "Form1.cs" file.
     Imports System.Collections.Generic
Imports BarcodeLib.Barcode.RDLCReports
Imports BarcodeLib.Barcode


Public Class SampleClass
Private m_description As String
Private m_price As Integer
Private m_bytes As Byte()

Public Sub New(description As String, price As Integer, data As String)
m_description = description
m_price = price
Dim barcode As New LinearRDLC()
barcode.Type = BarcodeType.CODE128
barcode.Data = data
m_bytes = barcode.drawBarcodeAsBytes()
End Sub

Public ReadOnly Property Bytes() As Byte()
Get
Return m_bytes
End Get
End Property

Public ReadOnly Property Description() As String
Get
Return m_description
End Get
End Property

Public ReadOnly Property Price() As Integer
Get
Return m_price
End Get
End Property
End Class

Public Class Merchant
Private m_products As List(Of SampleClass)

Public Sub New()
m_products = New List(Of SampleClass)()
m_products.Add(New SampleClass("code128", 25, "code128"))
m_products.Add(New SampleClass("code39", 30, "code39"))
m_products.Add(New SampleClass("qrcode", 15, "qrcode"))
End Sub
5. Run the project and barcodes are printed in your rdlc report.

Other .NET Barcode Generator Components