Our Customers
Contact Us Email: support@barcodelib.com
Home > .NET Crystal Reports Barcode > Crystal Reports Barcoding Guide > Crystal Reports Code 128 Barcode Generator Library
Download Barcode for Crystal Reports Trial

Code 128 Crystal Reports Barcode Generator DLL

Create and Print Code 128 Barcode Images for .NET Crystal Reports Application
  • Quickly install into .NET Crystal Reports Code 128 barcoding project with no need for any registration code or license key
  • Support Code 128 linear barcode generation on Crystal Report for Windows & ASP.NET web programs (design-time and runtime support)
  • Simply generate & print Code 128 barcode images on Crystal Reports using VB.NET or C# code
  • Support Code 128 barcode image generation in VS.NET class library & Console applications
  • Besides Code 128 barcode, .NET Crystal Reports barcoding library also supports other linear barcode images,
    like Codabar, Code 39, EAN-13, GS1-128, UPC, Interleaved 2 of 5
  • Provide affordable license price for this Crystal Reports Code 128 Barcode Generator Library
Code 128 Linear Barcode Information
Code 128 is a very high-density linear barcode type that supports the encoding of alphanumeric data. It has been widely adopted to many applications where a relatively large amount of data must be encoded in a relatively small amount of space.
Code 128 Barcode Compatibility: BarcodeLib.com .NET Crystal Reports Barcoding Library is designed based on ISO / IEC 15417 (2nd edition 2007-06-01) Code 128 barcode specification. So, all generated Code 128 barcodes are complying with this specification.
For more Code 128 barcode information, please see .NET Code 128 Barcode Introduction.
Using Crystal Reports Barcoding DLL to Generate Code 128 for ASP.NET
  1. Create a new ASP.NET website.
    • Create a new web site project using "ASP.NET Crystal Reports Web Site" as template, named "BarcodeforCrystalReportsWebSite".
  2. Add a Crystal Report item to the project.
    • Add a new item (Crystal Report), named "CustomerReport.rpt" to the project. view image
    • Select Expert as "Mail Label". Click "OK" button. view image
    • In "Mailing Labels Report Creation Wizard", click "Create New Connection", and expand "ADO.NET". view image
    • In "ADO.NET" form, select "CustomerDataSet.xsd" file in your downloaded package, and click "Finish" button. view image
    • In "Mailing Labels Report Creation Wizard", add table "Customer" under "ADO.NET", to selected table. And click "Next" button. view image
    • Add all three fields "ID", "CustomerId", "CustomerName", to "Fields to Display:". Click "Next". view image
    • Select default label "Return Address (Avery 5267)", and click "Finish" button.
    • Now you can view the report template, and find that field "Barcode" not in the report template. view image
    • Re-arrange the report template. view image
    • Drag field "Barcode" to the report template. Right click "Barcode" object and select "Format Object" menu. view image
    • In "Format Editor" form, check "Can Grow" property. view image
  3. Add Crystal Report Viewer to the Default.aspx.
    • Add a reference to BarcodeLib.Barcode.CrystalReports.dll.
    • Add the following code to the Default.aspx.cs file.
     using System.Data.OleDb;
using System.Drawing.Imaging;
using BarcodeLib.Barcode.CrystalReports;
using BarcodeLib.Barcode;


protected void Page_Load(object sender, EventArgs e)
{
// Create the database connection. Please change to correct data file (BarcodeDemoData.mdb) path.
OleDbConnection aConnection = new OleDbConnection(
"Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=C:/BarcodeLib_NETBarcode_Trial/ReportingData/BarcodeDemoData.mdb"
);
aConnection.Open();

OleDbDataAdapter dataAdapter = new OleDbDataAdapter("SELECT * FROM Customer", 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[])));

// Create an instance of Linear Barcode
LinearCrystal barcode = new LinearCrystal();
// Barcode settings
barcode.Type = BarcodeType.CODE128;
barcode.BarHeight = 50; //50 pixel
barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;

foreach (DataRow dr in ds.Tables[0].Rows)
{
barcode.Data = (int)dr["CustomerId"] + "";
barcode.Data = "128128";
byte[] imageData = barcode.drawBarcodeAsBytes();
dr["Barcode"] = imageData;
}

CrystalReportSource1.ReportDocument.Load(Server.MapPath("CustomerReport.rpt"));
CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables[0]);
CrystalReportSource1.DataBind();

}
4. Run the project.
Using Crystal Reports Barcoding DLL to Generate Code 128 for .NET WinForms
  1. Create a new Windows Application Project.
    • Create a new project using "Crystal Reports Application" as template, named "BarcodeforCrystalReports".
  2. Add a Crystal Report item to the project. View How to Add Crystal Report to Project
  3. Add Crystal Report Viewer to the window form.
    • Resize "Form1", and add "CrystalReportViewer" to the form, with the default setting unchanged. view image
    • Add a reference to BarcodeLib.Barcode.CrystalReports.dll.
    • Add the following code to the Form1.cs file.
     using System.Data.OleDb;
using System.Drawing.Imaging;
using BarcodeLib.Barcode.CrystalReports;
using BarcodeLib.Barcode;


private void Form1_Load(object sender, EventArgs e)
{
// Create the database connection. Please change to correct data file (BarcodeDemoData.mdb) path.
OleDbConnection aConnection = new OleDbConnection(
"Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=C:/BarcodeLib_NETBarcode_Trial/ReportingData/BarcodeDemoData.mdb"
);aConnection.Open();

OleDbDataAdapter dataAdapter = new OleDbDataAdapter("SELECT * FROM Customer", 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[])));

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

// Create an instance of Linear Barcode
LinearCrystal barcode = new LinearCrystal();
// Barcode settings
barcode.Type = BarcodeType.CODE128;
barcode.BarHeight = 50; //50 pixel
barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;

foreach (DataRow dr in ds.Tables[0].Rows)
{
barcode.Data = (int)dr["CustomerId"] + "";
barcode.Data = "128128";
byte[] imageData = barcode.drawBarcodeAsBytes();
dr["Barcode"] = imageData;
}

CustomerReport rpt = new CustomerReport();
rpt.SetDataSource(ds);

this.crystalReportViewer1.ReportSource = rpt;

//close the connection Its important.
aConnection.Close();

}
4. Run the project.
Using C# or VB.NET Code to Generate Code 128 Barcode for Crystal Reports
We provide online guide for .NET Crystal Reports Barcode Generation Using Visual C# or VB.NET, please click to see more details:
Linear & 2D Barcodes Supported by Crystal Reports Code 128 Generator DLL
Linear (1D) Barcodes:
Matrix(2D) Barcodes:
.NET Crystal Reports Barcode Generator Component - Generates Linear Barcodes on Crystal Reports: Codabar, Code 11, Code 2 of 5, Code 39, Code 93, Code 128, EAN-8, EAN-13, EAN 128/GS1 128, Interleaved 2 of 5, ITF14, MSI Plessey, Intelligent Mail (Onecode), PLANET, POSTNET, RM4SCC, UPC-A, UPC-E.
.NET Crystal Reports Barcode Generator Component - Generates 2D Barcodes on Crystal Reports: Data Matrix, PDF417, QR Code.