Barcode for RDLC > Generate Barcode in VB

How to Generate Barcodes in RDLC Using VB.NET

Encoding, Adjusting &Printing Barcodes for RDLC Reports in VB.NET IDEs
KA.Barcode for RDLC Reports Introduction
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
Test Environment
  • Microsoft Windows XP
  • Microsoft Visual Studio 2005
  • Visual Basic .NET
Create a RDLC Report in Windows Using VB.NET
  1. Create a new WinForms VB project in your Visual Studio, then create a "DataSet" named "AdventureWorks.xsd".
  2. Add "TableAdapter" item under the "Toolbox" to the new "DataSet".
  3. Using the connection to SQL Server AdventureWorks Sample Database.
  4. For SQL Statement, copy "SELECT ProductID, Name FROM Production.vProductAndDescription WHERE (CultureID = N'en') ".
  5. Right-click "vProductAndDescription" on the dataset to create a column named as "Barcode", and change its data type to "System.Byte[]" in "Properties" window.
  6. Then, create a new "Report" item and insert a table to your report.
  7. Add three columns in the dataset to the report table details section.
  8. Drag and drop "Image" item to the last column and name it "Barcode".
  9. Change "Source", "MIMEType", "Value" to "Database", "image/jpeg", "=Fields!Barcode.Value" respectively through "Properties" window.
  10. Drag "ReportViewer" under "Toolbox" to Form1 and bind the data collection.
  11. Add "KeepAutomation.Barcode.RDLC.dll" to your WinForms project reference.
  12. Refer to the following demo code.
  13. 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
' 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()
End Sub
Generate Barcode in RDLC Reports in Web Forms Using VB.NET
  1. Download and unzip the RDLC Reports barcode generator dll package and create an ASP.NET project.
  2. Add "KeepAutomation.Barcode.RDLC.dll" to you project reference.
  3. Right click your project In "Solution Explorer" to add a new "Class" item.
  4. Copy the sample code into the "Class" item. Go to "Build" tab and choose "Build Web Site".
  5. Switch to "Solution Explorer" and add a new "Report" item.
  6. Drag "Table" in "Toolbox" to the report. Then, go to "Website Data Sources" tab and insert "BarcodeName" and "BarcodeId".
  7. Add "Image" item to the last column and name it as "Barcode".
  8. Change "Source" to "Database", "MIMEType" to "image/jpeg", "Value" to "=Fields!Byte.Value" respectively in "Properties" window.
  9. Right click "Default.aspx" in "Solution Explorer" and select "View Designer" to add a "ReportViewer" to the project.
  10. 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()
Return m_byte
End Get
End Property
Public ReadOnly Property BarcodeName() As String
Return m_barcodeName
End Get
End Property
Public ReadOnly Property BarcodeId() As Integer
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
CompatibilityTest EnvironmentFor Windows VBFor Web VBUsing C#Using VB.NETUsing ASP.NETUsing .NET WinformsData Matrix for RDLCPDF417 for RDLCQR Code for RDLCmoreCodabar for RDLCCode 39 for RDLCCode 128 for RDLCEAN-8 for RDLCEAN-13 for RDLCEAN 128 for RDLCIntelligent Mail for RDLCInterleaved 2 of 5 for RDLCISBN for RDLCITF-14 for RDLCRM4SCC for RDLCUPC-A for RDLCUPC-E for RDLCmore
KeepAutomation provides complete barcode automation solutions. We recommend the customers use high quality document controls: ASP.NET Document Viewer, ASP.NET MVC Document Viewer, Document Viewer ASP.NET C#, ASP.NET PDF Viewer, ASP.NET Word Viewer, ASP.NET Excel Viewer, ASP.NET PDF Editor, MVC PDF Viewer, ASP.NET Annotate PDF, c# pdf sdk, C# View, edit PDF online , C# Convert PDF to Tiff, C# Convert PDF to text, txt, .net imaging sdk, C# PDF metadata edit from