How to generate and print Code 39 barcode in local reports (RDLC) in C#.NET or VB.NET projects
Avapose.Barcode Maker for RDLC
  • Reliable Code 39 barcode generator component for .NET applications
  • Create and print quality Code 39 barcodes in client report definition (rdlc) files
  • Easily export RDLC report to PDF files or Excel with Code 39 barcode in images
Code 3 of 9 Barcode Creation in Local Reports
  • Generate dynamic Code 39 barcode images in Client RDLC report files
  • Easily export RDLC to Excel, html, and PDF with Code 39 image inserted
  • Code 39 may be saved as graphic images without the use of fonts
  • C# or VB.NET source code is available with this barcode SDK & DLL
  • Strong-named and signed DLL with 100% Visual C# managed code
  • Compatible with SQL Server 2005 and 2008 with Adventure Works sample database installed
  • Easily enable or disable human-readable text in Code 39 symbol
  • Start and stop character “*” can be appended on the human-readable text or not
Avapose Code 39 Library for Client Report RDLC is a robust and powerful barcode component that lets you to add Code 39 generation and printing features into RDLC report files easily and fast. Besides generate Code 39, this SDK is capable of creating other 20+linear and 2D barcodes in RDLC with high quality.
Barcode Generation for RDLC Report Files - Code 39 Information
Code 39 (also known as Alpha39, Code 3 of 9, Code 3/9, Type 39, USS Code 39, or USD-3) is the first alphanumeric barcode to encode 26 uppercase letters, 10 digits and 7 special characters. It is a variable length, discrete and self-checking barcode symbology that used for various labels such as inventory and industrial applications. Code 39 has "start and stop" character "*" appended on both sides, but it is not a true encodable character.
Code 39 Generator Control for Client RDLC Report is capable of encoding:
  • Digital characters: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
  • Uppercase letters: from A to Z
  • Special characters: - (Dash), $ (Dollar), % (Percentage), (Space), . (Point), / (Slash), + (Plus)
Barcode Generation for RDLC - Code 39 Generation


Before generate Code 39 in RDLC, you should install:
  • Windows XP, Windows Vista, Windows 7,etc
  • .NET 2.0, 3.0 or greater
  • Microsoft Visual Studio 2005 or greater
  • Microsoft SQL Server 2005 (any version) or greater with Adventure Works sample database installed
  • Avapose.Barcode for RDLC

Code 39 Generation in RDLC in .NET WinForms Applications

  1. Open Visual Studio and create a new Windows Forms project naming "RDLC Barcode Demo";
  2. Add a new "DataSet" to the project:
    • Create a new "DataSet" and name it "AdventureWork.xsd";
    • Drag and drop "TableAdapter" to your created DataSet in toolbox;
    • Create a new connection or use existing connection to SQL Server AdventureWorks Sample Database;
    • Keep "Use SQL statements" to access the database and input "SELECT ProductID, Name FROM Production.vProductAndDescription WHERE (CultureID = N'en')" as SQL statements;
    • Right click "vProductAndDescription" on the DataSet to create a new column in the "DataTable" and name it "Barcode";
    • In the "properties" window, change this barcode "DataType" to "System.Byte[]";
  3. Create a new report:
    • Create a new report and name "Report1.rdlc";
    • Drag and drop a "Table" onto the report;
    • Add three columns in DataSet "AdventureWorks.xsd" to the report table details section, and drag an "Image" to the last column "Barcode";
    • In the "properties" window, set image item property "MIMEType" to "image/jpeg", "Source" to "Database" and "Value" to "=Fields!Barcode.Value";
  4. Drag "ReportViewer" control:
    • Drag a "ReportViewer" to "Form1.cs";
    • Choose "Report1.rdlc" report, and click "Rebind Data Source";
    • In the "Report.rdlc" page, click "Report", and select "Data Source";
    • Add "AdventureWorks_vProductAndDescription" to report data source;
  5. Add "Avapose.linearbarcode.winforms.dll" to .NET project reference from the "Solution Explorer";
  6. Copy the following code accordingly into the method Form1_Load and run the project. You can get the Code 39 images displayed on the report.

C# code

private void Form1_Load(object sender, EventArgs e)
// load data to the data table this.vProductAndDescriptionTableAdapter.Fill
// create a linear barcode object
Linear barcode = new Linear();
// set barcode type
barcode.LinearBarcode = LinearBarcode.Code39;
// draw barcodes for each data row
foreach (AdventureWorks.vProductAndDescriptionRow
row in this.AdventureWorks.vProductAndDescription.Rows)
{// set barcode encoding data value
barcode.Data = row.ProductID.ToString();
// set drawing barcode image format
barcode.Format = System.Drawing.Imaging.ImageFormat.Jpeg;
row.Barcode = barcode.drawBarcodeAsBytes();

VB code

Private Sub Form1_Load(ByVal sender 
As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code
loads data into the 'AdventureWorks.vProductAndDescription' table.
You can move, or remove it, as needed.
Dim barcode As New Linear()
barcode.LinearBarcode = LinearBarcode.Code39
Dim row As AdventureWorks.vProductAndDescriptionRow
For Each row In Me.AdventureWorks.vProductAndDescription.Rows
' set barcode encoding data value
barcode.Data = row.ProductID.ToString()
' set drawing barcode image format
barcode.Format = System.Drawing.Imaging.ImageFormat.Png
row.Barcode = barcode.drawBarcodeAsBytes()
End Sub
Related Code 39 Barcode Integration & Generation Information
The following Code 3 of 9 barcode integration and creation information links relate to this product that may be of interest to you:
Testimonial for Avapose.Barcode for RDLC
We bought your Barcode Generator for RDLC a few weeks ago, and it works pretty well
Carios Louis, Eureka Software Ltd,UK