Using C# Barcode Generator for RDLC reports
How to Generate Barcodes in RDLC Using C#.NET

Generate, print 1d, 2d barcodes label in RDLC reports report designer, viewer without font. Free download.
Barcode for RDLC > Generate Barcode in C#
Encoding, Adjusting &Printing Barcodes for RDLC Reports in C#.NET IDEs
KA.Barcode for RDLC Reports Overview
KeepAutomation Barcode Generator for RDLC is a standard and powerful barcode component that lets you integrate barcode generation and printing features into RDLC Reports. The easy-to-use .NET SDK could be managed in .NET with Visual C#. Windows applications as well as ASP.NET Web Forms are supported. This page will show you how to generated barcodes in RDLC using C#.NET.
Compatibility & Requirements
  • .NET Development Environments: Visual Studio 2005/2008 /2010 installed, .NET Version greater than 2.0, C#.NET & VB.NET
  • Compatible Operating Systems: Windows 2000, XP, Vista, and Windows 7
  • Minimum System Requirements: 500 MHZ processor, 128 MB RAM, 5 MB available hard drive space
Test Environment
  • Microsoft Windows XP
  • Microsoft Visual Studio 2005
  • Visual C#.NET
How to Generate Barcodes in RDLC in WinForms Using C#
  1. Open your Visual Studio and create a new WinForms project, then create a "DataSet" with the name "AdventureWorks.xsd".
  2. Drag "TableAdapter" item under the "Toolbox" to the new "DataSet".
  3. Link the connection to SQL Server AdventureWorks Sample Database.
  4. Copy "SELECT ProductID, Name FROM Production.vProductAndDescription WHERE (CultureID = N'en') " as SQL Statement.
  5. Right-click "vProductAndDescription" on the dataset to create a column (named as "Barcode"), and change the data type to "System.Byte[]" in "Properties" window.
  6. Go to "Solution Explorer" and create a new "Report" item.
  7. Insert a table to your report and add three columns in the dataset to the report table details section.
  8. Drag and drop "Image" item to the last column and name it "Barcode".
  9. Change "Source", "MIMEType", "Value" to "Database", "image/jpeg", "=Fields!Barcode.Value" respectively through "Properties" window.
  10. Drag "ReportViewer" under "Toolbox" to Form1.
  11. Click "Report1.rdlc[Design]", then click "Report" and choose "Data Sources....", click "Add to Report" & lastly click "OK".
  12. Add reference "KeepAutomation.Barcode.RDLC.dll" to your project.
  13. Right click "Form1.cs" and select "View Code", then compile the following sample code.
  14. Use "KeepAutomation.Barcode.RDLC" namespace and debug.
C# Sample code
     private void Form1_Load(object sender, EventArgs e)
{
// load data to the data table this.vProductAndDescriptionTableAdapter.Fill
this.vProductAndDescriptionTableAdapter.Fill(this.AdventureWorks.vProductAndDescription);
// create a linear barcode object
BarCode barcode = new BarCode();
// set barcode type
barcode.Symbology = KeepAutomation.Barcode.Symbology.Code11;
// draw barcodes for each data row
foreach (AdventureWorks.vProductAndDescriptionRow
row in this.AdventureWorks.vProductAndDescription.Rows)
{// set barcode encoding data value
barcode.CodeToEncode = row.ProductID.ToString();
// set drawing barcode image format
barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;

row.Barcode = barcode.generateBarcodeToByteArray();
}
this.reportViewer1.RefreshReport();
}
How to Generate Barcodes in RDLC in Web Forms Using C#
  1. Open your Visual Studio and create a website project, and add "KeepAutomation.Barcode.RDLC.dll" to reference.
  2. Right click your project In "Solution Explorer" to add a new "Class" item.
  3. Copy the sample code into the "Class" item. Go to "Build" tab and choose "Build Web Site".
  4. Go to "Solution Explorer" and right click your web project to add a new "Report" item.
  5. Go to "Toolbox" and drag "Table" in "Report Items" to the report. Then, go to "Website Data Sources" tab and insert "BarcodeName" and "BarcodeId".
  6. Insert "Image" item to the last column and name it as "Barcode".
  7. Revise "Source" to "Database", "MIMEType" to "image/jpeg", "Value" to "=Fields!Byte.Value" respectively in "Properties" window.
  8. In "Solution Explorer", right click "Default.aspx" and select "View Designer" to add a "ReportViewer" to the project
  9. Choose your created report and run your ASP.NET web project.
C# Sample code
     public class BarocdeDemo
{

private string m_barcodeName;
private int m_barcodeId;
private byte[] m_byte;
public BarocdeDemo(string barcodeName, int barcodeId, string data)
{
m_barcodeName = barcodeName;
m_barcodeId = barcodeId;
BarCode barcode = new BarCode();
barcode.Symbology = KeepAutomation.Barcode.Symbology.EAN13;
barcode.CodeToEncode = data;
m_byte = barcode.generateBarcodeToByteArray();
}
public byte[] Byte
{
get { return m_byte; }
}
public string BarcodeName
{
get { return m_barcodeName; }
}
public int BarcodeId
{
get { return m_barcodeId; }
}
}
public class Merchant
{
private List<BarocdeDemo> m_barcodes;
public Merchant()
{
m_barcodes = new List<BarocdeDemo>();
m_barcodes.Add(new BarocdeDemo("code11", 001, "code11"));
m_barcodes.Add(new BarocdeDemo("code25", 002, "code25"));
m_barcodes.Add(new BarocdeDemo("code39", 003, "code39"));
m_barcodes.Add(new BarocdeDemo("code93", 004, "code93"));
m_barcodes.Add(new BarocdeDemo("code128",005, "code128"));
m_barcodes.Add(new BarocdeDemo("upcean", 006, "upcean"));
}
public List<BarocdeDemo> GetProducts()
{
return m_barcodes;
}
}