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.
- Visual Studio 2010 or Later version.
Steps to Follow:
- Open up the visual studio and create a new C# Windows forms application project.
- Go to the solution explorer and right click on project file and click on Manage 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.
4. Now after installation, go to your form. Add a picture box, a textbox and a button control from toolbox.
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.
Watch a full video tutorial to learn how to Generate QR Code in C#.
I hope you enjoyed this tutorial. Please don’t forget to subscribe our Official YouTube Channel C# UI Academy