C# Barcode Generator Tutorial

How to Generate Linear & 2D Bar Codes in Visual C#.NET Applications


  • Generate barcodes in C#.NET Class & console applications
  • Generate barcodes in C# ASP.NET web applications
  • Generate barcodes in C#.NET Windows Forms applications
  • Generate barcodes in Reporting Service & Crystal Reports
  • Completely developed in C#.NET
  • Compatible with latest barcode symbology ISO Standards
  • Mature barcode generating components used by 1000+ clients


Generating barcodes in C#.NET is an easy task with OnBarcode .NET Barcode Generator Components. OnBarcode provides various barcode libraries for generating barcodes using Microsoft Visual C#.NET on ASP.NET, C# Class, Windows Applications, Console Applications, and .NET Reporting Applications.

This article helps you how to choose the right barcode component and integrate in your C# applications.

Compare THREE .NET Barcode Generator components in different C#.NET development environments

         .NET Barcode for ASP.NET

  • Generate barcodes in C#.NET class

  • Generate barcodes in C# console applications

  • Generate barcodes in C# Web Forms projects

         .NET Barcode for WinForms

  • Generate barcodes in C#.NET class

  • Generate barcodes in C# console applications

  • Generate barcodes in C# Windows Forms projects

         .NET Barcode Suite

  • Generate barcodes in C#.NET class

  • Generate barcodes in C# console applications

  • Generate barcodes in C# Web Forms projects

  • Generate barcodes in C# Windows Forms projects

  • Generate barcodes in C# Reporting Service 2005 & 2008 projects



C#.NET Barcode Generator Quick Start

1. How to install .NET Barcode Generator Control to your Visual C# project?

Add OnBarcode.Barcode.WinForms.dll or OnBarcode.Barcode.ASPNET.dll to C# project reference

2. How to create linear barcodes in C# class?

Linear barcode = new Linear();                 // Create linear barcode object  
barcode.Type = BarcodeType.CODE39;	       // Set barcode symbology type to Code-39
barcode.Data = "0123456789";                   // Set barcode data to encode
barcode.X = 1;                                 // Set barcode bar width (X dimension) in pixel
barcode.Y = 60;                                // Set barcode bar height (Y dimension) in pixel
barcode.drawBarcode("csharp-code39.png");      // Draw & print generated barcode to png image file

Barcode Code-39

3. How to draw & print QR-Code in C# class?

QRCode qrCode = new QRCode();                  // Create QRCode object                  
qrCode.Data = "VB.NET QRCode";                 // Set QR Code data to encode
qrCode.DataMode = QRCodeDataMode.Auto;         // Set QRCode data mode (QR-Code Barcode Settings)
qrCode.drawBarcode("csharp-qrcode.jpg");       // Draw & print generated QR Code to jpeg image file

4. How to create & print Data Matrix in C# class?

DataMatrix datamatrix = new DataMatrix();             // Create Data Matrix object
datamatrix.Data = "VB.NET DataMatrix";                // Set Data Matrix data to encode
datamatrix.DataMode = DataMatrixDataMode.ASCII;       // Set Data Matrix data mode (Data Matrix Barcode Settings)
datamatrix.drawBarcode("csharp-data-matrix.gif");     // Draw & print generated Data Matrix to gif image file

5. How to create & print PDF-417 in C# class?

PDF417 pdf417 = new PDF417();                // Create PDF417 object  
pdf417.Data = "VB.NET PDF-417";              // Set Data Matrix data to encode
pdf417.DataMode = PDF417DataMode.Auto;       // Set PDF-417 data mode (PDF-417 Barcode Settings)
pdf417.RowCount = 3;                         // Set PDF-417 number of rows
pdf417.ColumnCount = 5;                      // Set PDF-417 number of columns
pdf417.drawBarcode("csharp-pdf417.gif");     // Draw & print generated Data Matrix to gif image file

6. In C# Barcode Generator, how to print & encode barcodes to GIF, JPEG, PNG & BMP?

Linear barcode = new Linear();                 // Create linear barcode object  
barcode.Type = OnBarcode.Barcode.BarcodeType.CODE39;
barcode.Data = "0123456789";

// Encode barcodes to other image format, by change file extension
barcode.drawBarcode("C://csharp-barcode-code39.gif");


C# Barcode Generator Supporting Barcode Symbology Types


(Click to view each barcode type property settings)







Barcode Generation Guide for .NET / Java Developers

.NET Barcode Generation     |     C# Barcode Generation     |     ASP.NET Barcode Generation     |     VB.NET Barcode Generation

Java Barcode Generation