Print Barcode as Image in RDLC Report Using C# coding

Generate, add, encode and insert various barcode images into RDLC reports in C#.NET | Free trial version download
Products
Barcode in RDLC
Tutorial
Demo now
License & Price
2D Barcode for RDLC
1D Barcode for RDLC
Barcode in RDLC
Add Barcode Image to RDLC Report Using Barcode Generator in C#.NET - Overview
RDLC Client Report Barcode Generator/Library DLL is a multifunctional and easy-to-use barcode control component to generate barcode as images instead of fonts in RDLC local reports using C# and VB.NET coding in ASP.NET projects and Windows Forms applications. 40+ linear and 2D/Matrix barcode symbols and features are built together as a dynamic DLL for easy installation and RDLC barcode generation, free barcode sample code is provide online with available source code.
Barcode images inserted in RDLC local report are maintained well when exporting RDLC to other file formats such as PDF, Excel, and Word without additional installation of barcode control library using C#, or VB.NET coding. For creating RDLC barcode image using VB.NET, please refer to how to generate barcode images using VB.NET in RDLC client side report.
RDLC Report Barcode Generation Using C#.NET- Prerequisites and Compatibility
Prerequisites
  • Terrek Barcode Generator DLL for RDLC local report
  • Microsoft .NET Framework 2.0, 3.0, 4.0 or above
  • Microsoft Visual Studio 2005 / 2008 / 2010 (any version)
  • Visual C#.NET (any version)
  • Visual Studio 2005 / 2008 / 2010 ReportViewer Local Reports (RDLC) (runtime support)
Compatibility
  • Visual Basic.NET, Managed C++, Borland Delphi for .NET
  • Windows XP, Windows Vista, Windows 7, Windows Server 2003, Windows Server 2008, etc
  • .NET Framework 2.0, 3.0, 3.5 and above
Sample C# coding of Generating Barcode Images in RDLC Report - RDLC in WinForms Applications
Using linear barcode Code 39 as an example(step-by-step developer guide in RDLC barcode)
  • Open Visual Studio and create a new Windows Forms project naming "RDLC Barcode Demo"
  • Choose the language type as Visual C# and select the report application as template
  • Create a new "DataSet" to the project and name it in database model.
  • Create a new column and name it as "Barcode", then create a new report
  • Drag and drop a table onto report, and drag an image to the new column named "Barcode"
  • Change the image format, source, value and other settings in properties windows
  • Drag and drop a ReportViewer control onto the WinForms applications at design time
  • Add "Terrek.Barcode.DotNet.dll" to .NET project reference
  • Copy the following sample C# coding accordingly to insert barcode images in RDLC client side local report
Code 39 C# Sample Code to Insert Barcode Image into RDLC Local Report in Window Applications
private void Form1_Load(object sender, EventArgs e)
{
// load data to the data table
this.vProductAndDescriptionTableAdapter.Fill(this.AdventureWorks.vProductAndDescription);
// create a linear barcode object
BarcodeControl barcode = new BarcodeControl();
// set barcode type to Code 39
barcode. Symbol = BarcodeSymbol.Code39;
// draw barcodes for each data row
foreach (AdventureWorks.vProductAndDescriptionRow row in this.AdventureWorks.vProductAndDescription.Rows)
{
// set barcode encoding data value
barcode.BarcodeData = row.ProductID.ToString();
// set drawing barcode image format
barcode.BarcodeFormat = System.Drawing.Imaging.ImageFormat.Png;
row.Barcode = barcode.drawBarcodeAsBytes();
}
this.reportViewer1.RefreshReport();
}
Sample C# coding of Creating Barcode Images in RDLC Report - RDLC in ASP.NET Project
Using Matrix/2D barcode QR Code as an example, (see detail user manual in RDLC barcode)
  • Open Visual Studio and create ASP.NET Web Form project using C#.NET as programming language
  • Add the Terrek.AspNet.dll to the project reference
  • Add a new class and copy the following C# code accordingly, then build a web site
  • Insert a table into the created new report
  • Add "Name" and "Price" items to the report in "Website Data Source"
  • Drag a image item to the column and change properties if necessary
  • Drag a "View Designer" to the report and debug it
QR Code C# Sample Coding to Create Barcode Image in RDLC Report in ASP.NET
using Terrek.Barcode;
public class Product
{
private string m_name;
private int m_price;
private byte[] m_bit;
public Product(string name, int price, string data)
{
m_name = name;
m_price = price;
BarcodeControl qrcode = new BarcodeControl();
qrcode. Symbol = BarcodeSymbol.QRCode;
qrcode.BarcodeData = data;
m_bit = barcode.drawBarcodeAsBytes();
}
public byte[] Bit
{
get { return m_bit; }
}
public string Name
{
get
{
return m_name;
}
}
public int Price
{
get
{
return m_price;
}
}
}
public class Merchant
{
}