|
A QR code short form of Quick response code is a sort of matric barcode machine readable optical label which contains information about the item to which it is affixed. The QR code label often contains information about the company, product or a tracker which points to a website.
Today we see QR codes attached on all the products or on the literatures of the products we purchase from the market.
In this tutorial we are going to develop an application in VB.Net in which we will Generate QR code in VB.Net of our own. We are going to hold certain information in that Generated QR code which we can scan using any QR code scanner.
To star our project of Generating a QR code in VB.Net we need a ThoughtWorks.QRCode.dll file which you can download from ThoughtWorks.QRCode and we need to add a reference of that in our project.
To start our project first create a user interface as shown below :
We have added three textboxes with the name changed as txtName, txtAge and txtClass and a Picturebox with the name picturebox1 and a button with name btnCreate.
Now, import a namespace of ThoughtWorks.QRCode as
Imports ThoughtWorks.QRCode.Codec
Now, type the following code on the click event of btnCreate as under
Private Sub btnCreate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreate.Click
Dim objqrcode As QRCodeEncoder = New QRCodeEncoder
Dim img As Image
Dim btm As Bitmap
Dim str As String
Dim thk As String = " Thank you:"
str = txtName.Text + " " + txtAge.Text + " " + txtClass.Text + thk
objqrcode.QRCodeScale = 2
img = objqrcode.Encode(str)
btm = New Bitmap(img)
btm.Save("qrimage.jpg")
PictureBox1.ImageLocation = "qrimage.jpg"
End Sub
Finally hit the F5 to run the project.
The video tutorial of this project is available on YouTube.
0 comments:
Post a Comment