QR Code in C#

Generate QR Code in C#

QR Code (Quick Response Code) is a very popular information encoding technique. In this quick tutorial we will learn how to generate QR Code in C#.

It is a type of matrix bar code or two dimensional bar code. It was first designed in 1994 in Japan. QR Code is a machine readable label. It contains information about an item to which it is attached.

Tools Required:

  1. Visual Studio 2010 or Later version.

Steps to Follow:

  1. Open up the visual studio and create a new C# Windows forms application project.
  2. Go to the solution explorer and right click on project file and click on Manage Nuget Package Manager.
Click on Nuget Package Manager

3. Now click on Browse tab and search for QRCoder. Select the first Package and click on Install Button and wait for installation make sure you have the internet connectivity on your PC.

Click on Install button

4. Now after installation, go to your form. Add a picture box, a textbox and a button control from toolbox.

Form Design

5. Now go to OnClick event of generate button and write this code:

QRCoder.QRCodeGenerator QG = new QRCoder.QRCodeGenerator();
var MyData = QG.CreateQrCode(textBox1.Text, QRCoder.QRCodeGenerator.ECCLevel.H);
var code = new QRCoder.QRCode(MyData);
pictureBox1.Image = code.GetGraphic(50);

This Code will encode your text of textbox into QRCode and show it in the Picture Box.

Video Tutorial:

Watch a full video tutorial to learn how to Generate QR Code in C#.

Generate QR Code

Source Code:

I hope you enjoyed this tutorial. Please don’t forget to subscribe our Official YouTube Channel C# UI Academy

2 Replies to “Generate QR Code in C#”

  1. Greetings from Idaho! I’m bored to tears at work so I decided to browse your blog on my iphone during lunch break. I love the knowledge you provide here and can’t wait to take a look when I get home. I’m shocked at how fast your blog loaded on my mobile .. I’m not even using WIFI, just 3G .. Anyways, good site!

Comments are closed.