How to Generate Code 39 in Crystal Reports

How to Create Code 39 Barcode Using Crystal Reports Barcode Control
  • Advanced Code 39 .NET control completely integrated into .NET Framework 2.0 and above versions
  • Compatible with ISO/IEC 16388 (second edition 2007-05-15) specifications for Code 39 barcoding
  • Generate high-quality Code 39 and Code 39 Extended in Crystal Report easily
  • Create reporting solution that takes user input by using Visual Studio 2005, 2008 and 2010
  • Modify barcode height, width, wide/narrow ratio using VB.NET or C#.NET programming
  • Maintain barcode image on exported files such as PDF, Word, Excel and rich text formats
Code 39 Barcode Generator for Crystal Reports Introduction
KA.Barcode for Crystal Reports helps you integrate .NET applications (ASP.NET & WinForms) with Crystal Reports during runtime. Field could be easily changed to Code 39 and Code 39 Extended barcode images in Crystal Report by simple clicks. .NET programmers have full access to the properties of a report and the underlying report objects.
Code 39 Barcode Introduction
Code 39, the first alpha-numeric symbology developed in 1974, is a linear barcode with variable length. Code 39 utilizes start and stop characters which allows bi-directional scanning.
Code 39 Valid Character Set
  • Alphanumeric data: 0-9, upper-case lettersA-Z
  • Special characters: - (Dash), $ (Dollar), : (Colon), / (Slash), . (Point), + (Plus)
Download Code 39 Barcode Generator for Crystal Reports
Welcome to download KA.Barcode for Crystal Reports Trial for Code 39 barcode generation in Crystal Reports. The trial version is free of charge and it includes:
  • KeepAutomation.Barcode.Crystal.dll
  • KACrystalData.mdb
  • ProductDataSet.xsd
  • End User License Agreement
  • User Manual
  • Order Page
This trial package can only be used for testing purpose for the reason that a "KA Barcode" watermark will appear on generated Code 39 barcode image randomly. KA.Barcode for Crystal Reports Trial can be used continuously.
Code 39 Barcode Generation in Crystal Reports in ASP.NET
  1. Download and unzip the evaluation version of Crystal Reports Barcode Generator.
  2. Open your Visual Studio and create a new web project with "ASP.NET Crystal Reports Web Site" as template.
  3. Create a new report "Using the Report Wizard", choose "Standard", and click "OK".
  4. In "Data" form, double click "Create New Connection", and expand "ADO.NET".
  5. In "ADO.NET" form, add "ProductDataSet.xsd" file, and click "Finish" button.
  6. In "Data" form, add table "Product" and click "Next". In "Fields" form, add all three columns in the table "Product" and click "Finish".
  7. In CrystalReport1.rpt, add field "Barcode" to the report Section 3.
  8. Add "KeepAutomation.Barcode.Crystal.dll" to your project reference.
  9. Copy the following demo codes 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 code39 = new BarCode();
//Barcode settings
code39.Symbology = KeepAutomation.Barcode.Symbology.Code39;
code39.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;

foreach (DataRow dr in ds.Tables[0].Rows)
{
code39.CodeToEncode = (int)dr["ProductId"] + "";
byte[] imageData = code39.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 code39 As New BarCode()
'Barcode settings
code39.Symbology = KeepAutomation.Barcode.Symbology.Code39
code39.ImageFormat = System.Drawing.Imaging.ImageFormat.Png

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

End Sub
If you want to generate Code 39 barcode image in .NET WinForms, please refer to Crystal Reports Barcode Creation Guide in WinForms.
Code 39 Barcode Properties
Free Trial DownloadCrystal Code 39Code 39 PropertiesUsing C#Using VB.NETUsing ASP.NETUsing .NET WinformsData Matrix for Crystal ReportPDF417 for Crystal ReportQR Code for Crystal ReportmoreCodabar for Crystal ReportCode 128 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.