Introduction of KA.Barcode for Crystal Reports
KeepAutomation Crystal Reports Barcode Generator free demo is a reliable barcode component sdk that can be used in .NET language environment (such as C# & VB.NET programming) to generate standard barcodes in Crystal Reports automatically.
KeepAutomation provides free tutorial for developers to create barcode images. This barcode generator control library is compatible with multiple widely-used windows systems. It's simple to use this freeware trial version to abstract large numbers of barcode pictures.
Compatibility & Requirements
- Development Environments: Visual Studio 2005 or above versions, Visual C#, Visual Basic.NET, Crystal Reports for .NET (runtime), .NET Framework 2.0, or greater
- Operating System Compatibility: Windows Vista / Windows7 / Windows XP / Window Server 2005 / 2008
- Microsoft Windows XP
- Microsoft Visual Studio 2005
- Visual Basic .NET
Generate Barcodes in Crystal Reports in WinForms Using VB
Evaluation Package Overview
Download Demo Package of KeepAutomation Barcode Generator for Crystal Reports and unzip. It is allowed to completely implement or display functions of barcode images in document for various applications, including transaction, medicine & console applications. With this barcode generator library, implementers may import characters into project for barcode generation.
This demo package is always used to capture graphics barcode images using VB code. It is also used to resize barcode images through height, length, human-readable text, etc.
Display the demo dataset "KACrystalData.mdb" from the unzipped evaluation package, you will find a table named "Product" with three columns inside: "ID", "ProductId", "ProductName".
There is a CustomerDataSet.xsd file for "KACrystalData.mdb" that is used to define the above three columns in "Product" table as well as an extra column named "Barcode".
Use VB.NET Class to Generate Barcodes for Crystal Reports in WinForms
- Create a new .NET project with "Crystal Reports Application" as template. Name the project as "CrystalReportsBarcode".
- Using the Report Wizard to create a new report, and choose "Standard", and click "OK" button.
- Expand "Create New Connection", find "ADO.NET" in "Data" form and expand it.
- In "Connection" form, select the "ProductDataSet.xsd" in your unzipped package. Then click "Finish" button.
- In "Data" form, add table "Product" and click "Next".
- In "Fields" form, add all three columns in the table "Product". Click "Finish".
- In CrystalReport1.rpt, drag and drop "Barcode" in the "Field Explorer" to the report Section 3.
- In .NET project "solution explorer", add "KeepAutomation.Barcode.Crystal.dll" to your project reference.
- Open your "Form1.cs", copy the following demo code and run the report.
VB Sample code
Dim aConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/KACrystalData.mdb")
aConnection.Open()
Dim dataAdapter As New OleDbDataAdapter("select * from Product", aConnection)
Dim ds As New DataSet()
dataAdapter.Fill(ds)
'Add the Barcode column to the DataSet
ds.Tables(0).Columns.Add(New DataColumn("Barcode", GetType(Byte())))
'Create an instance of Linear Barcode
'Use DataMatrixCrystal for Data Matrix
'Use PDF417Crystal for PDF417
'Use QRCodeCrystal for QR Code
Dim barcode As New BarCode()
'Barcode settings
barcode.Symbology = KeepAutomation.Barcode.Symbology.UPCA
barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png
For Each dr As DataRow In ds.Tables(0).Rows
barcode.CodeToEncode = CInt(dr("ProductId")) & ""
Dim imageData As Byte() = barcode.generateBarcodeToByteArray()
dr("Barcode") = imageData
Next
CrystalReportSource1.ReportDocument.Load(Server.MapPath("CrystalReport1.rpt"))
CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables(0))
CrystalReportSource1.DataBind()
Generate Barcodes in Crystal Reports in Web Forms Using VB
- Open your Visual Studio, create a new web project with "ASP.NET Crystal Reports Web Site" as template;
- Create a new report "Using the Report Wizard", choose "Standard", and click "OK";
- In "Data" form, double click "Create New Connection", and expand "ADO.NET".
- In "ADO.NET" form, select "ProductDataSet.xsd" file in your downloaded package, and click "Finish" button.
- In "Data" form, add table "Product" and click "Next".
- In "Fields" form, add all three columns in the table "Product". Click "Finish".
- In CrystalReport1.rpt, add field "Barcode" to the report Section 3;
- Add "KeepAutomation.Barcode.Crystal.dll" to your project reference in "Solution Explorer";
- Right click "Default.aspx" in"Solution Explorer" and choose "View Code";
- Use the following demo code accordingly and run the project.
VB Sample code
Dim aConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/KACrystalData.mdb")
aConnection.Open()
Dim dataAdapter As New OleDbDataAdapter("select * from Product", 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 New BarCode()
barcode.Symbology = KeepAutomation.Barcode.Symbology.EAN13
For Each dr As DataRow In ds.Tables(0).Rows
barcode.CodeToEncode = CInt(dr("ProductId")) & ""
Dim imageData As Byte() = barcode.generateBarcodeToByteArray()
dr("Barcode") = imageData
Next
Dim rpt As New CrystalReport1()
rpt.SetDataSource(ds)
Me.crystalReportViewer1.ReportSource = rpt
aConnection.Close()