How to generate and print Data Matrix 2D barcodes in local reports (RDLC) in C# or VB.NET
Avapose.Barcode Generator for RDLC
  • Reliable Data Matrix barcode generator component for .NET applications
  • Create and print quality Data Matrix barcodes in client report definition (rdlc) files
  • Easily export RDLC report to PDF files or Excel with Data Matrix barcode in images
Barcode RDLC > Barcode in RDLC > 2D > Data Matrix
Data Matrix Generation in Local Reports
  • Insert high-quality Data Matrix barcode iamge in Client RDLC report files
  • Easily customize Data Matrix properties via VB.NET and C#.NET in RDLC report
  • Strong-named and time-stamped DLL for .NET 2.0, 3.0, 3.5, 4.0
  • Managed code 100% created in C# and source code for this barcode SDK is available
  • Microsoft SQL Server 2005, or advanced version support
  • Flexible to save Data Matrix as image in Gif, Tiff, Bmp, Png or Jpeg format
  • Perfectly and quickly export generated Data Matrix images to Acrobat PDF, html and Excel XLS
  • Royalty-free with the purchase of developer license
Data Matrix Barcode Library for RDLC client report is a mature and reliable barcode control that lets you to add advanced barcode generation features into RDLC report files easily. Barcodes are dynamically created in Client RDLC report as high-quality Gif, Tiff, Bmp, Png or Jpeg image. It is quick and easy to export generated Data Matrix barcode images on PDF, html, and Excel without any distortion.
Barcode Generation for RDLC Report Files - Data Matrix Information
Data Matrix is a high-density, 2D barcode symbology that encodes a large amount of data including text, number and actual data bytes. Because of its high encoding ability, it is often used on small area of square modules with a unique perimeter pattern. Data Matrix shapes as either square with sizes from 10x10 to 144x144 or rectangular with sizes from 8x18 to 16x48.
Valid encoded data for Data Matrix in Client RDLC Reports:
  • Standard ASCII values from 0 to 127
  • Extended ASCII values from 128 to 225
Barcode Generation for RDLC - Data Matrix Generation


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

Data Matrix 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.matrixbarcode.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 Data Matrix 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
Matrix barcode = new Matrix();
// set barcode type
barcode.MatrixBarcode = MatrixBarcode.Datamatrix;
// 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 Matrix()
barcode.MatrixBarcode = MatrixBarcode.Datamatrix
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 Data Matrix Barcode Integration & Generation Information
The following Data Matrix 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