Barcode for RDLC > Generate Barcode in RDLC

How to Generate Barcodes in RDLC Reports

How to Encode and Print Linear and Matrix Barcode Images for RDLC Reports
  • Strong-named assemblies compiled with C#.NET for barcode creation
  • Perfectly compatible with Microsoft Visual Studio 2005, 2008 and 2010
  • Provide C# and VB sample codes for users to draw barcodes in RDLC Reports
  • Support creating linear barcodes for RDLC Reports, like Code 39, EAN-13, UPC-A, etc
  • Easy to generate, display 2D barcode types including QR Code, Data Matrix and PDF-417
  • Available to set barcode width, resolution, orientation, image format and so on
  • Offer royalty-free, flexible and perpetual license of Barcode Generator for RDLC Reports
Download KA.Barcode for RDLC Reports
Term of Evaluation
Users are able to use KA.Barcode for RDLC Reports evaluation for ever without charge.
Limitation of Evaluation
Randomly, a "KA Barcode" watermark will appear on generated barcode images. So, users can only apply them to non-commercial applications. Only linear and 2D barcode images created with our suitable license are permitted to be used in business applications.
How to Create Barcodes in RDLC Reports for Web Forms
  1. Create an ASP.NET web form project in Visual Studio and add "KeepAutomation.Barcode.RDLC.dll" to reference.
  2. In "Solution Explorer", right click your project to add a new "Class" item named "BarcodeDemo".
  3. Copy the sample code into your created "Class" item. Go to "Build" tab and choose "Build Web Site".
  4. Switch to "Solution Explorer" and right click your web project to add a new "Report" item.
  5. Drag a "Table" in "Report Items" under "Toolbox" to the report and go to "Website Data Sources" tab, insert "BarcodeName" and "BarcodeId".
  6. Now, switch back to "Toolbox", insert "Image" item to the last column and name the column "Barcode".
  7. Respectively revise "Source" to "Database", "MIMEType" to "image/jpeg", "Value" to "=Fields!Byte.Value" 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. (Choose "Modify the Web.config file to enable debugging" in the pop-up window and click "OK").
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.Code128Auto;
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;
VB Sample code
     Public Class BarocdeDemo

Private m_barcodeName As String
Private m_barcodeId As Integer
Private m_byte As Byte()
Public Sub New(barcodeName As String, barcodeId As Integer, data As String)
m_barcodeName = barcodeName
m_barcodeId = barcodeId
Dim barcode As New BarCode()
barcode.Symbology = KeepAutomation.Barcode.Symbology.Code128Auto
barcode.CodeToEncode = data
m_byte = barcode.generateBarcodeToByteArray()
End Sub
Public ReadOnly Property [Byte]() As Byte()
Return m_byte
End Get
End Property
Public ReadOnly Property BarcodeName() As String
Return m_barcodeName
End Get
End Property
Public ReadOnly Property BarcodeId() As Integer
Return m_barcodeId
End Get
End Property
End Class
Public Class Merchant
Private m_barcodes As List(Of BarocdeDemo)
Public Sub New()
m_barcodes = New List(Of BarocdeDemo)()
m_barcodes.Add(New BarocdeDemo("code11", 1, "code11"))
m_barcodes.Add(New BarocdeDemo("code25", 2, "code25"))
m_barcodes.Add(New BarocdeDemo("code39", 3, "code39"))
m_barcodes.Add(New BarocdeDemo("code93", 4, "code93"))
m_barcodes.Add(New BarocdeDemo("code128", 5, "code128"))
m_barcodes.Add(New BarocdeDemo("upcean", 6, "upcean"))
End Sub
Public Function GetProducts() As List(Of BarocdeDemo)
Return m_barcodes
End Function
End Class
How to Create Barcodes in RDLC Reports for WinForms
  1. Create a new Windows Forms application in Visual Studio and then create a "DataSet" with the name "AdventureWorks.xsd".
  2. Move to the "Toolbox", select "Pointer", and drag "TableAdapter" to the new "DataSet".
  3. Define the connection to SQL Server AdventureWorks Sample Database.
  4. Insert the following string as SQL Statement: "SELECT ProductID, Name FROM Production.vProductAndDescription WHERE (CultureID = N'en') ".
  5. Right-click "vProductAndDescription" on the dataset to add a column (name it as "Barcode"), and change the data type to "System.Byte[]" in "Properties" window.
  6. Switch to "Solution Explorer" and add a new "Report" item.
  7. Insert a table to the new "Report" item and add three columns in the dataset to the report table details section.
  8. Drag and drop "Image" item to the last column, named as "Barcode".
  9. Switch to "Properties" window and change "Source", "MIMEType", "Value" to "Database", "image/jpeg", "=Fields!Barcode.Value" respectively.
  10. Then select "Form1.cs[Design]" and drag "ReportViewer" to Form1.
  11. Bind the data collection (Click "Report1.rdlc[Design]", then click "Report" and choose "Data Sources....").
  12. Add "KeepAutomation.Barcode.RDLC.dll" to project reference.
  13. Right click "Form1.cs" and select "View Code", then copy the sample code into the method Form1_Load.
  14. Use "KeepAutomation.Barcode.RDLC" namespace and run your Windows Forms project.
C# Sample code
     private void Form1_Load(object sender, EventArgs e)
// load data to the data table this.vProductAndDescriptionTableAdapter.Fill
// create a linear barcode object
BarCode barcode = new BarCode();
// set barcode type
barcode.Symbology = KeepAutomation.Barcode.Symbology.Code39;
// 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();
VB Sample code
     Private Sub Form1_Load(sender As Object, e As EventArgs)
' load data to the data table this.vProductAndDescriptionTableAdapter.Fill
' create a linear barcode object
Dim barcode As New BarCode()
' set barcode type
barcode.Symbology = KeepAutomation.Barcode.Symbology.Code39
' draw barcodes for each data row
For Each row As AdventureWorks.vProductAndDescriptionRow In Me.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()
End Sub
Download Free TrialIn Web RDLC ReportsIn Windows RDLCUsing C#Using VB.NETUsing ASP.NETUsing .NET WinformsData Matrix for RDLCPDF417 for RDLCQR Code for RDLCmoreCodabar for RDLCCode 39 for RDLCCode 128 for RDLCEAN-8 for RDLCEAN-13 for RDLCEAN 128 for RDLCIntelligent Mail for RDLCInterleaved 2 of 5 for RDLCISBN for RDLCITF-14 for RDLCRM4SCC for RDLCUPC-A for RDLCUPC-E for RDLCmore
KeepAutomation provides complete barcode automation solutions. We recommend the customers use high quality document controls: ASP.NET Document Viewer, ASP.NET MVC Document Viewer, Document Viewer ASP.NET C#, ASP.NET PDF Viewer, ASP.NET Word Viewer, ASP.NET Excel Viewer, ASP.NET PDF Editor, MVC PDF Viewer, ASP.NET Annotate PDF, c# pdf sdk, C# View, edit PDF online , C# Convert PDF to Tiff, C# Convert PDF to text, txt, .net imaging sdk, C# PDF metadata edit from