How to Generate Code 128 in Crystal Reports

Generate Code 128 Barcode for Crystal Reports With C# and VB Class
  • Powerful report tool, completely integrated into .NET Framework 2.0 and above
  • 100% built and created in the managed Visual C#.NET
  • Provide free C# or VB sample code for Code 128 barcode creation in Crystal Reports
  • Easily create Code Set A, Code Set B and Code Set C of Code 128 in Crystal Reports
  • Change fields to Code 128 barcode image by simple clicks
  • Print Code 128 barcode image in a specific orientation, such as 0, 90, 180, etc
  • Offer royalty-free developer license for this Crystal Reports Code 128 Barcode SDK
Crystal Reports Code 128 Barcode Library Overview
KA.Barcode for Crystal Reports lets you integrate .NET applications (ASP.NET & WinForms) with Crystal Reports during runtime to build powerful reporting solution. .NET programmers have full access to the properties such as barcode height, margin, X-dimension etc. The properties could be changed by writing C# or VB code.
Code 128 Barcode Overview
Code 128 is a linear barcode appended with a mandatory check digit which was based on ISO/IEC 15417. Start characters A, B and C of Code 128 define the corresponding code set to be used initially in the symbol.
Code 128 Valid Character Set
  • Standard ASCII values: 0-128
  • Extended ASCII Values in accordance with ISO 8859-1: 128-255
Crystal Reports Code 128 Barcode SDK Download
Users are free to download our Code 128 Barcode Generation SDK for Crystal Reports Evaluation. The evaluation version of this barcode generator is composed of the following items:
  • KeepAutomation.Barcode.Crystal.dll
  • KACrystalData.mdb
  • ProductDataSet.xsd
  • End User License Agreement
  • User Manual and Order Page
Evaluation version of Crystal Reports Code 128 Barcode SDK is available for an unlimited period of time. But a "KA Barcode" watermark is included in Code 128 barcode image generated with this evaluation version. So the evaluation version can not be used to commercial applications.
Crystal Reports Code 128 Barcode Creation in ASP.NET
  1. Open your Visual Studio and create a new web project with "ASP.NET Crystal Reports Web Site" as template.
  2. Create a new report "Using the Report Wizard", choose "Standard", and click "OK".
  3. In "Data" form, double click "Create New Connection", and expand "ADO.NET".
  4. Add "ProductDataSet.xsd" file in "ADO.NET" form, and click "Finish" button.
  5. In "Data" form, add table "Product" and click "Next". In "Fields" form, add all three columns in the table "Product" and click "Finish".
  6. Add field "Barcode" to the report Section 3 in CrystalReport1.rpt.
  7. Locate "KeepAutomation.Barcode.Crystal.dll" to your project reference.
  8. Compile the sample codes below and run the project.
C# Sample code
     protected void Page_Load(object sender, EventArgs e)
{
OleDbConnection aConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/KACrystalData.mdb");
aConnection.Open();

OleDbDataAdapter dataAdapter = new OleDbDataAdapter("select * from Product",aConnection);
DataSet ds = new DataSet();
dataAdapter.Fill(ds);

//Add the Barcode column to the DataSet
ds.Tables[0].Columns.Add(new DataColumn("Barcode", typeof(byte[])));

BarCode code128 = new BarCode();
//Barcode settings
code128.Symbology = KeepAutomation.Barcode.Symbology.Code128Auto;
code128.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;

foreach (DataRow dr in ds.Tables[0].Rows)
{
code128.CodeToEncode = (int)dr["ProductId"] + "";
byte[] imageData = code128.generateBarcodeToByteArray();
dr["Barcode"] = imageData;
}
CrystalReportSource1.ReportDocument.Load(Server.MapPath("CrystalReport1.rpt"));
CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables[0]);
CrystalReportSource1.DataBind();

}
VB Sample code
     Protected Sub Page_Load(sender As Object, e As EventArgs)
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())))

Dim code128 As New BarCode()
'Barcode settings
code128.Symbology = KeepAutomation.Barcode.Symbology.Code128Auto
code128.ImageFormat = System.Drawing.Imaging.ImageFormat.Png

For Each dr As DataRow In ds.Tables(0).Rows
code128.CodeToEncode = CInt(dr("ProductId")) & ""
Dim imageData As Byte() = code128.generateBarcodeToByteArray()
dr("Barcode") = imageData
Next
CrystalReportSource1.ReportDocument.Load(Server.MapPath("CrystalReport1.rpt"))
CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables(0))
CrystalReportSource1.DataBind()

End Sub
Code 128 Barcode Properties
If you want to know more information on Code 128, please view this Code 128 barcode properties page.
Free Trial DownloadCrystal Code 128Code 128 PropertiesUsing C#Using VB.NETUsing ASP.NETUsing .NET WinformsData Matrix for Crystal ReportPDF417 for Crystal ReportQR Code for Crystal ReportmoreCodabar for Crystal ReportCode 39 for Crystal ReportEAN-8 for Crystal ReportEAN-13 for Crystal ReportEAN 128 for Crystal ReportIntelligent Mail for Crystal ReportInterleaved 2 of 5 for Crystal ReportISBN for Crystal ReportITF-14 for Crystal ReportRM4SCC for Crystal ReportUPC-A for Crystal ReportUPC-E for Crystal Reportmore
KeepAutomation provides complete barcode automation solutions for add barcode display 2-dimensional, barcode generation capacity api, and barcode mobile applications. We recommend the customers use high quality ASP.NET html5 document viewer, c# pdf sdk, C# merge PDF files, Split PDF in C#, C# View, edit PDF online , C# Convert PDF to Tiff, C# Convert PDF to text, txt, .net imaging sdk, C# PDF metadata edit from RasterEdge.com.