BizCode Generator for Crystal Report
The most advanced barcode control for Crystal Report
Quick Overviews
  • Crystal Report .NET SDK
  • Linear & 2D barcode support
  • .NET 2.0/3.0/4.0 support
  • Support C#, VB.NET, etc.
  • Multiple file formats support
How to Create Barcodes in Crystal Report with a Given Size
Barcode Creator for Crystal Reports is a robust and reliable barcode control DLL that is capable of encoding 40+ linear and 2D barcodes in Crystal Reports with customized barcode size.
With the applying of "Auto Size" property, developers are easy to generate barcodes with fixed bar width and height or given barcode image size in Crystal Report with high quality and high readability.
Compatibility & Requirements
.NET Development Environments
-Visual studio 2005/2008/2010 installed
-.NET Framework 2.0 and greater versions
-C#.NET, VB. NET, or Borland Delphi
Compatible Project Types
-Crystal Report(runtime support)
Compatibility & Test Environment
Compatible Operating Systems
-Windows 2000
-Windows XP
-Windows Vista
-Windows 7
-Windows Server 2005, etc
Test Environment:
-Microsoft Windows XP
-Microsoft Visual Studio 2005
-.NET Crystal Report
-Visual C#.NET & Visual Basic.NET
How to Create Barcodes in Crystal Report with Given Size
  1. Download BizCode Generator for Crystal Report Free Trial and unzip;
  2. Start Visual Studio and create a new Crystal Reports. Then add "BusinessRefinery.Barcode.web.dll" to your Crystal Reports project reference;
  3. Accept the defaults of "Use Report Expert" and "Standard Report" in Crystal Report Gallery dialog box.
  4. 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.
  5. 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".
  6. In CrystalReport1.rpt, drag and drop field "Barcode" to the report Section 3.
  7. Right click "Default.aspx" in"Solution Explorer" and choose "View Code".
  8. Copy the C# or VB.NET code accordingly in the following sample.
How to Create Barcodes in Crystal Report using C# and VB.NET with Given Size
protected void Page_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
[])));
Linear barcode = new Linear();
barcode.Type = BarcodeType.CODE39;
barcode.BarcodeHeight = 60;
barcode.BarcodeWidth = 150;
barcode.AutoSize = true;
foreach (DataRow dr in ds.Tables[0].Rows)
{
barcode.Data = (int)dr["CustomerId"] + "";
byte[] imageData = barcode.drawBarcodeAsBytes();
dr["Barcode"] = imageData;
}
CrystalReportSource1.ReportDocument.Load(Server.MapPath
("CrystalReport1.rpt"));
CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables[0]);
CrystalReportSource1.DataBind();
aConnection.Close();
}
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 New Linear()
barcode.Type = BarcodeType.CODE39
barcode.BarcodeHeight = 60
barcode.BarcodeWidth = 150
barcode.AutoSize = AutoSize.true
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
How to Create Barcodes in Crystal Report using C# and VB.NET with Fixed Bar Width
protected void Page_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[])));
Linear barcode = new Linear();
barcode.Type = BarcodeType.CODE39;
barcode.BarHeight = 60;
barcode.BarWidth = 3;
barcode.AutoSize = true;
foreach (DataRow dr in ds.Tables[0].Rows)
{
barcode.Data = (int)dr["CustomerId"] + "";
byte[] imageData = barcode.drawBarcodeAsBytes();
dr["Barcode"] = imageData;
}
CrystalReportSource1.ReportDocument.Load(Server.MapPath
("CrystalReport1.rpt"));
CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables[0]);
CrystalReportSource1.DataBind();
aConnection.Close();
}
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 New Linear()
barcode.Type = BarcodeType.CODE39
barcode.BarHeight = 60
barcode.BarWidth = 3
barcode.AutoSize = AutoSize.true
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