Our Customers
Contact Us Email: support@barcodelib.com
Home > .NET Barcode > C# Barcode Generation Guide > C# QR-Code Generator for .NET, ASP.NET
Download Barcode for .NET Suite Trial

C# QR-Code Generator Control for .NET

How to Generate QR-Code Barcodes in .NET applications using Visual C#
  • Simple to create 2D QR Code barcode in .NET projects using C#.NET
  • Completely built in Visual C#, compatible with .NET 2.0 and later versions
  • Generate QR Code Barcode in ASP.NET, WinForms using C#.NET programming
  • Paint, draw QR Code barcode in Crystal Reports, SSRS Reports and RDLC Reports
  • QR Code barcode images printed are in accordance with the latest ISO /IEC 18004 specification
  • Create high-quality QR Code barcode images in Png, Jpeg, Gif formats and save locally
  • C# demo code provided to control QR Code barcode format and size easily
  • Complete barcode settings to adjust various QR Code barcode parameters
  • .NET Barcode Generator component provides royalty-free developer license for lifetime use
C# QR Code Barcode Introduction
QR-Code is also known as Quick Response Code, Denso Barcode, QRCode, JIS X 0510, ISO/IEC 18004.
Compatibility: Barcode for .NET component SDK is compatible with ISO/IEC 18004 (Second Edition 2006-09-01) bar code symbology specification.
QR Code barcode is a matrix (or two-dimensional) symbology designed by Denso Wave for the automotive industry. Now QR Code has grown popular due to its fast readability and large storage capacity, compared with linear barcodes.
QR Code barcode is a matrix (or two-dimensional) symbology designed by Denso Wave for the automotive industry. Now QR Code has grown popular due to its fast readability and large storage capacity, compared with linear barcodes.
For more QR Code information, please refer to .NET QR-Code Introduction.
How to Generate QR-Code Bar Code in C# Class?


  1. Add Barcodelib.Barcode.ASP.NET.dll or BarcodeLib.Barcode.WinForms.dll to your C# project reference.
    • Click "Project" and select "Add Reference...".
    • Click "Project" and select "Add Reference...".
  2. Add BarcodeLib barcoding dlls to Visual Studio Toolbox.
    • Right click in Toolbox and select "Choose Items...".
    • In the pop-up window, click "Browse..." to locate the dll BarcodeLib.Barcode.WinFroms.dll or Barcodelib.Barcode.ASP.NET.dll.
    • Click "OK" and you will find four items listed in VS Toolbox, for example QRCodeWinForm, DataMatrixWinForm, LinearWinForm, and PDF417WinForm. And now it's done!


Now you can copy the C# sample code below to create a QR Code barcode image in .NET Class Library.
     BarcodeLib.Barcode.QRCode qrbarcode = new BarcodeLib.Barcode.QRCode();

// Select QR Code data encoding type: numeric, alphanumeric, byte, and Kanji to select from.
qrbarcode.Encoding = BarcodeLib.Barcode.QRCodeEncoding.Auto;
qrbarcode.Data = "123456789012";

// Adjusting QR Code barcode module size and quiet zones on four sides.
qrbarcode.ModuleSize = 3;
qrbarcode.LeftMargin = 12;
qrbarcode.RightMargin = 12;
qrbarcode.TopMargin = 12;
qrbarcode.BottomMargin = 12;

// Select QR Code Version (Symbol Size), available from V1 to V40, i.e. 21 x 21 to 177 x 177 modules.
qrbarcode.Version = BarcodeLib.Barcode.QRCodeVersion.V1;

// Set QR-Code bar code Reed Solomon Error Correction Level: L(7%), M (15%), Q(25%), H(30%)
qrbarcode.ECL = BarcodeLib.Barcode.QRCodeErrorCorrectionLevel.L;
qrbarcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;

// More barcode settings here, like ECI, FNC1, Structure Append, etc.

// save barcode image into your system

// Generate QR Code barcode & output to byte array
byte[] barcodeInBytes = qrbarcode.drawBarcodeAsBytes();

// Generate QR Code barcode to Graphics object
Graphics graphics = ...;

// Generate QR Code barcode and output to HttpResponse object
HttpResponse response = ...;

// Generate QR Code barcode and output to Stream object
Stream stream = ...;
Above Free QR Code sample code is written in Visual C# 2005
How to Generate QR-Code Bar Code in C# Generator for ASP.NET Web Applications?
With this C# QR Code generator, you can stream QR Code barcode images in ASP.NET using C#.NET in two ways.
  1. The simplest way for QR Code barcode generation is through BarcodeLib Buildin ASP.NET Barcode Application.
    • Unzip the downloaded evaluation package, and copy barcode folder and its contents to your IIS folder, eg. C:\inetpub.
    • Create a new virtual directory in your IIS, name it "barcode", and connect it to the above "barcode" folder in inetpub.
    • Restart IIS for a barcoding test.
    • To test your installation, open your web browser and navigate to:

      For further QR Code barcode setting, please view more web stream QR Code URL parameters here: .NET QR-Code Generator Property Settings.
    • To insert this QR Code image in your aspx or html page, simply pass the url to IMG tag or src value.
      For example:
      <img src=http://YourDomain:port/barcode/qrcode.aspx?Data=12345678&LeftMargin=12&RightMargin=12&TopMargin=12&BottomMargin=12 />
      This method will not generate any barcode images in your IIS server side.
  2. Another method is to create QR Code barcodes through ASP.NET web form controller.
    • Intall ASP.NET barcode controller to your barcoding project by adding reference.
    • Add barcode library to your Visual Studio toolbox.
    • Open your unzipped trial package, and copy files "qrcode.aspx", "qrcode.aspx.cs" to the aspx page, in which you will be generating QR Code images
    • Now you can drag QRCodeASPNET to your ASP.NET web site, and change QR code settings through properties window on the right or use above free C# source code.

    • Debug and you will see the QR Code barcode generated on your aspx pages.
How to Create QR-Code Barcodes in C# Generator for Windows Applications?
  1. Add reference to BarcodeLib.Barcode.WinForms.dll for your C# barcoding project.
  2. Add BarcodeLib.Barcode.WinForms.dll to your Visual Studio toolbox.
  3. Now please drag the QRCodeWinForm to your windows form or use above free C# source code, and a QR Code barcode is generated.
C# Barcode Generator Library Supported Linear & 2D Barcodes
C# 1D Barcode Generation:
C# 2D Barcode Generation:
C# Barcode DLL Generates 1D (Linear) Barcodes: Codabar, Code 11, Code 2 of 5, Code 39, Code 93, EAN-8, EAN-13, Interleaved 2 of 5, ITF-14 (UPC Shipping Container Symbol), Code 128, EAN 128/GS1 128, MSI Plessey, Intelligent Mail, Planet, Postnet, RM4SCC (British Royal Mail), UPC-A, UPC-E.
C# Barcode DLL Generates 2D (Matrix) Barcodes: Data Matrix, PDF 417, QR Code.