KeepAutomation Barcode Generator for RDLC is a .NET Component SDK developed for .NET Framework developers to print linear or 2d barcode images in Report Definition Language Client-Side report file. Visual Basic .NET could be used to manage the generator tool. It is compatible with commonly-used windows systems. This page will let you know how to generate barcode in RDLC Reports in .NET projects using VB.NET programming with demo freeware.
Barcode generation and configuration example tutorial, guide and friendly interface will be provided for implementers to attach multiple barcode pictures. And users can copy sample codes to directly insert numeric, book or rectangle barcode symbology pictures. KeepAutomation offers flexible developer license with suitable price.
Compatibility & Requirements
- .NET Development Platforms: Visual Studio 2005/2008 /2010, .NET Version greater than 2.0, C#.NET & VB.NET
- OS Compatibility: Windows 2000, XP, Vista, and Windows 7
- Least System Requirements: 500 MHZ processor, 128 MB RAM, 5 MB available hard drive space
- Microsoft Windows XP
- Microsoft Visual Studio 2005
- Visual Basic .NET
Create a RDLC Report in Windows Using VB.NET
- Create a new WinForms VB project in your Visual Studio, then create a "DataSet" named "AdventureWorks.xsd".
- Add "TableAdapter" item under the "Toolbox" to the new "DataSet".
- Using the connection to SQL Server AdventureWorks Sample Database.
- For SQL Statement, copy "SELECT ProductID, Name FROM Production.vProductAndDescription WHERE (CultureID = N'en') ".
- Right-click "vProductAndDescription" on the dataset to create a column named as "Barcode", and change its data type to "System.Byte[]" in "Properties" window.
- Then, create a new "Report" item and insert a table to your report.
- Add three columns in the dataset to the report table details section.
- Drag and drop "Image" item to the last column and name it "Barcode".
- Change "Source", "MIMEType", "Value" to "Database", "image/jpeg", "=Fields!Barcode.Value" respectively through "Properties" window.
- Drag "ReportViewer" under "Toolbox" to Form1 and bind the data collection.
- Add "KeepAutomation.Barcode.RDLC.dll" to your WinForms project reference.
- Refer to the following demo code.
- Use "KeepAutomation.Barcode.RDLC" namespace and run your project.
VB Sample code
Private Sub Form1_Load(sender As Object, e As EventArgs)
' load data to the data table this.vProductAndDescriptionTableAdapter.Fill
Me.vProductAndDescriptionTableAdapter.Fill(Me.AdventureWorks.vProductAndDescription)
' create a linear barcode object
Dim barcode As New BarCode()
' set barcode type
barcode.Symbology = KeepAutomation.Barcode.Symbology.Codabar
' draw barcodes for each data row
For Each row As AdventureWorks.vProductAndDescriptionRow In Me.AdventureWorks.vProductAndDescription.Rows
' set barcode encoding data value
barcode.CodeToEncode = row.ProductID.ToString()
' set drawing barcode image format
barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png
row.Barcode = barcode.generateBarcodeToByteArray()
Next
Me.reportViewer1.RefreshReport()
End Sub
Generate Barcode in RDLC Reports in Web Forms Using VB.NET
- Download and unzip the RDLC Reports barcode generator dll package and create an ASP.NET project.
- Add "KeepAutomation.Barcode.RDLC.dll" to you project reference.
- Right click your project In "Solution Explorer" to add a new "Class" item.
- Copy the sample code into the "Class" item. Go to "Build" tab and choose "Build Web Site".
- Switch to "Solution Explorer" and add a new "Report" item.
- Drag "Table" in "Toolbox" to the report. Then, go to "Website Data Sources" tab and insert "BarcodeName" and "BarcodeId".
- Add "Image" item to the last column and name it as "Barcode".
- Change "Source" to "Database", "MIMEType" to "image/jpeg", "Value" to "=Fields!Byte.Value" respectively in "Properties" window.
- Right click "Default.aspx" in "Solution Explorer" and select "View Designer" to add a "ReportViewer" to the project.
- Choose your created report and debug.
VB Sample code
Public Class BarocdeDemo
Private m_barcodeName As String
Private m_barcodeId As Integer
Private m_byte As Byte()
Public Sub New(barcodeName As String, barcodeId As Integer, data As String)
m_barcodeName = barcodeName
m_barcodeId = barcodeId
Dim barcode As New BarCode()
barcode.Symbology = KeepAutomation.Barcode.Symbology.UPCA
barcode.CodeToEncode = data
m_byte = barcode.generateBarcodeToByteArray()
End Sub
Public ReadOnly Property [Byte]() As Byte()
Get
Return m_byte
End Get
End Property
Public ReadOnly Property BarcodeName() As String
Get
Return m_barcodeName
End Get
End Property
Public ReadOnly Property BarcodeId() As Integer
Get
Return m_barcodeId
End Get
End Property
End Class
Public Class Merchant
Private m_barcodes As List(Of BarocdeDemo)
Public Sub New()
m_barcodes = New List(Of BarocdeDemo)()
m_barcodes.Add(New BarocdeDemo("code11", 1, "code11"))
m_barcodes.Add(New BarocdeDemo("code25", 2, "code25"))
m_barcodes.Add(New BarocdeDemo("code39", 3, "code39"))
m_barcodes.Add(New BarocdeDemo("code93", 4, "code93"))
m_barcodes.Add(New BarocdeDemo("code128", 5, "code128"))
m_barcodes.Add(New BarocdeDemo("upcean", 6, "upcean"))
End Sub
Public Function GetProducts() As List(Of BarocdeDemo)
Return m_barcodes
End Function
End Class