Generate Barcode Image in Crystal Reports using VB.NET

Generate high quality barcode images in Crystal Report project with source code available
Products
Tutorial
Demo now
License & Price
2D Barcode for Crystal Report
1D Barcode for Crystal Report
Barcode VB.NET > Barcode in VB.NET
Crystal Report Barcode Image Creator SDK - Overview
Barcode Generator SDK for Crystal Reports is an easy-to-use and mature .NET control SDK that integrate into Crystal Reports to generate 40+ linear and 2D barcodes using C# and VB.NET class library. It is compatible with Microsoft Visual Studio and other .NET development environments. All 40+ linear and 2D barcode symbologies are built into a single, small, fully-functional and redistributable DLL file for easy and quick insertion in Crystal Reports.
Besides specify how to generate barcodes in Crystal Reports using VB, Terrek also provide other solution of generating barcodes in Crystal Reports such as print barcodes in Crystal Reports using C#, create barcodes in ASP.NET Crystal Report, Add barcodes in Windows Crystal Report.
Prerequisites and Compatibility
Prerequisites
  • Terrek Barcode Generator for Crystal Reports
  • Microsoft .NET Framework 2.0, 3.0, 4.0 or above
  • Microsoft Visual Studio 2005 / 2008 / 2010
  • Visual Basic.NET (any version)
  • .NET Crystal Reports (runtime support)
Compatibility
  • Visual C#.NET, Managed C++, Borland Delphi for .NET
  • Windows XP, Windows Vista, Windows 7, Windows Server 2003, Windows Server 2008, etc
  • .NET Framework 2.0, 3.0, 3.5 and above
Create Barcodes in Crystal Report Windows Version using VB.NET Database
  • Download Terrek Barcode Generator for Crystal Reports and unzip
  • Create a new .NET project with "Crystal Reports Application" as template. Name the project as "CrystalReportsBarcode"
  • Create a new report "Using the Report Wizard", and choose "Standard", and click "OK" button
  • In "Data" form, expand "Create New Connection", and expand "ADO.NET"
  • In "Connection" form, select the "CustomerDataSet.xsd" in your downloaded sample dataset package. Then click "Finish" button
  • In "Data" form, add table "Customer" and click "Next"
  • In "Fields" form, add all three columns in the table "Customer". Click "Finish"
  • In CrystalReport1.rpt, drag and drop "Barcode" in the "Field Explorer" to the report Section 3
  • In .NET project "solution explorer", add "Terrek.Barcode.DotNet.dll" to your project reference
  • Copy the following VB sample code to generate barcodes in Crystal Reports in Windows expression (the following is generating Data Matrix in Crystal Report Windows apps using VB.NET)
Generate Barcode Images in Crystal Report in WinForms Project using VB - Sample Code
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim aConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/Demo/BarcodeDemoData.mdb")
aConnection.Open()
Dim dataAdapter As New OleDbDataAdapter("select * from Customer", aConnection)
Dim ds As New DataSet()
dataAdapter.Fill(ds)
'add a new column named "Barcode" to the DataSet, the new column data type is byte[]
ds.Tables(0).Columns.Add(New DataColumn("Barcode", GetType(Byte())))
Dim DataMatrix As Terrek.Barcode.DotNET.DotNETControl
DataMatrix.Symbol = Terrek.Barcode.BarcodeSymbol.DataMatrix
For Each dr As DataRow In ds.Tables(0).Rows
barcode.Data = CInt(dr("CustomerId")) & ""
Dim imageData As Byte() = barcode.drawBarcodeAsBytes()
dr("Barcode") = imageData
Next
Dim rpt As New CrystalReport1()
rpt.SetDataSource(ds)
Me.CrystalReportViewer1.ReportSource = rpt
aConnection.Close()
End Sub
Add Barcodes in Crystal Report ASP.NET Version using VB Database
  • Download Terrek Barcode Generator for Crystal Reports and unzip
  • Start Visual Studio and create a new Crystal Reports. Then add "Terrek.Barcode.AspNet.dll" to your Crystal Reports project reference
  • Accept the defaults of "Use Report Expert" and "Standard Report" in Crystal Report Gallery dialog box.
  • In the Data tab, expand "Create New Connection" and choose "ADO.NET". After click "next" button, you could see the "Connection" form. Navigate to the "CustomerDataSet.xsd" in the downloaded package and click "Finish" button.
  • Add table "Customer" as selected tables in the "Data" form and click "Next". In following "Fields" form, add all three columns available to right "Customer" fields, and Click "Finish".
  • In CrystalReport1.rpt, drag and drop field "Barcode" to the report Section 3
  • Run the Crystal Report Project (following example: create PDF-417 in Crystal Report in ASP.NET using VB)
Free Sample Code of Making Barcode Image in ASP.NET Crystal Report using VB.NET
aConnection.Open()
Dim dataAdapter As New OleDbDataAdapter("select * from Customer", aConnection)
Dim ds As New DataSet()
dataAdapter.Fill(ds
Protected Sub CrystalReportViewer1_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Init
Dim aConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/Demo/BarcodeDemoData.mdb")
aConnection.Open()
Dim dataAdapter As New OleDbDataAdapter("select * from Customer", aConnection)
Dim ds As New DataSet()
dataAdapter.Fill(ds)
'add a new column named "Barcode" to the DataSet, the new column data type is byte[]
ds.Tables(0).Columns.Add(New DataColumn("Barcode", GetType(Byte())))
Dim barcode As Terrek.Barcode.DotNET.DotNETControl
barcode.Symbol = Terrek.Barcode.BarcodeSymbol.PDF417
For Each dr As DataRow In ds.Tables(0).Rows
barcode.Data = CInt(dr("CustomerId")) & ""
Dim imageData As Byte() = barcode.drawBarcodeAsBytes()
dr("Barcode") = imageData
Next
CrystalReportSource1.ReportDocument.Load(Server.MapPath("CrystalReport1.rpt"))
CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables(0))
CrystalReportSource1.DataBind()
aConnection.Close()
End Sub