Guideline for Inserting Barcode Images into Crystal Report Using .NET Component
Avapose.Barcode for Crystal Report
  • Crystal Report for .NET barcode creation SDK
  • VB.NET, C#, Managed C++ and Borland Delphi for .NET 2.0/3.0/4.0
  • High-quality linear & 2D barcode generation for all scanners
Barcode Crystal Report > Barcode in Crystal Report
Avapose.Barcode for Crystal Report Control
This .NET Control for Crystal Report is fully integrated in Visual Studio 2005, 2008 and 2010. And its source code is provided for barcode generation in .NET Crystal Reports. Using this control, about 20 + linear barcodes (EAN 13, EAN 8, Code 39 etc.) and 2D barcodes (QR Code, Data Matrix and PDF 417) could be easily created with simple clicks.
Avapose.Barcode for Crystal Report offers comprehensive .NET control to create barcode images in PNG, BMP, GIF, JPEG, TIFF image formats. Crystal Report with barcode images could be exported as PDF, Word, Excel and other formats.
This barcode control is an easy-to-use component which provides perpetual license and complete source code in purchased version. Avapose offers the most comprehensive and robust .NET generation DLL that stay embedded in Crystal Report.
.NET Barcode Generator for Crystal Report - Supported Barcodes
2D Barcodes:
QR Code

PDF 417 Data Matrix
1D Barcodes:
Codabar Code 11 Code 25 Code 39 Code 93
Code 128 EAN 8 EAN 13 EAN 128 Identcode
Onecode Interleaved 25 ISBN ISSN ITF-14
Leitcode MSI PLANET POSTNET RM4SCC
UPC-A UPC-E
Barcode Control for Crystal Report - Installation Requirements

Requirements:

  • Windows XP, Windows Vista and Windows 7
  • .NET 2.0, 3.0, 3.5 and above
  • Microsoft Visual Studio 2005/2008/2010
  • Avapose.Barcode for .NET Winforms

Setup Process:

  1. Download Avapose.Barcode for .NET Winforms and unzip it;
  2. Add barcode into selected field of the Crystal Report project;
  3. Add linear or matrix generation dll as reference of Crystal Report.
.NET Barcode Control for Crystal Report - Barcode Generation

Implement .NET Barcode Generation DLL for Crystal Report into Visual Studio

  1. Download Avapose.Barcode for .NET Winforms and unzip;
  2. Open Crystal Reports project in Visual Studio, and then choose "Standard" in the window titled "Using the Report Wizard" and click "OK".
  3. Expand "Create New Connection" and "ADO.NET" in the popped up "Data" form. Select "next" button. This brings up the "Connection" form. Navigate to the "CustomerDataSet.xsd" in the downloaded package and click "Finish" button.
  4. On the next "Data" form, add table "Customer" as selected tables and click "Next". In following "Fields" tab, double click all three fields available and move them to right "Customer" fields, and Click "Finish".
  5. In CrystalReport1.rpt, drag and drop field "Barcode" to the report Section 3 (Details).
  6. Switch to .NET project solution explorer, and then add "OnBarcode.Barcode.WinForms.dll" to your project reference.
(For more features with detailed information, see Linear Barcodes Tutorial and 2D Barcodes Tutorial)

Create Barcodes Using .NET Barcode Control for Crystal Report

  1. Open your Form1.cs in Design view, and then double click the form to enter Form1.cs.
  2. Copy the VB.NET or C# programming codes below into the method Form1_Load and using the namespace "Avapose.linearbarcode".
  3. Run the report. Barcode images will be displayed on the Reporting Service.
  4. Crystal Report with barcode images could be exported as PDF, Word, Excel or rich text formats.

C# code

private void Form1_Load(object sender, EventArgs e)
{
OleDbConnection aConnection = new OleDbConnection(
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/Demo/BarcodeDemoData.mdb");
aConnection.Open();
OleDbDataAdapter dataAdapter = new OleDbDataAdapter("select * from Customer"
, aConnection);
DataSet ds = 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", typeof(byte[])));
MatrixBarcode = new Matrix();
Barcode. MatrixBarcode = MatrixBarcode.DataMatrix;
foreach (DataRow dr in ds.Tables[0].Rows)
{
Barcode.BarcodeData = (int)dr["CustomerId"] + "";
byte[] imageData = Barcode.drawBarcodeAsBytes();
dr["Barcode"] = imageData;
}
CrystalReport1 rpt = new CrystalReport1();
rpt.SetDataSource(ds);
this.crystalReportViewer1.ReportSource = rpt;
aConnection.Close();

VB 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 Barcode As new Matrix()
Barcode.MatrixBarcode = MatrixBarcode.DataMatrix
For Each dr As DataRow In ds.Tables(0).Rows
Barcode.BarcodeData = 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

(For more sample codes, please see C#.NET Barcodes Tutorial and VB.NET Barcodes Tutorial)
Avapose.Barcode for Crystal Report Testimonial
We bought your product Barcode Generator for Crystal Report a few weeks ago, and it works pretty well!
Carlos Louis, Eureka Software Ltd, UK.