Skip to main content

QR (Quick Response) Code Generator using VB.NET with Source Code

This QR (Quick Response) CODE Generator is a simple program that generates text into QR code using messaging toolkit QR code and developed using VB.NET. It also allows the QR code to be exported as an image and automatically saved into your Documents folder with the file name as equivalent in the textbox. The QR Code can be useful in some Software depending on what logic you will use. For Example in an Inventory System, you can generate a QR Code for each product or items and create a tracking feature that has a QR Code Scanning and by that, the system user will have a better experience using the system and also this can help to prevent Typing Error instances and the user can quickly track the item.

Features

  • Generate QR Code
  • Export QR Code as an Image

Tools used:

  • Labels
  • Picture Box
  • Buttons

Library Used

MessagingToolkit.QRCode

This is the Layout that I have created in this QR Code Generator program:

The below code is the one I used to generate QR Code from the text entered and display the code into the Picture Box.

  1. Private Sub btnGenerate_Click(sender As Object, e As EventArgs) Handles btnGenerate.Click
  2. Try
  3. Call qrcodeGen()
  4.  
  5. Catch ex As Exception
  6. MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Information)
  7. End Try
  8. End Sub
  9.  
  10. Private Sub qrcodeGen()
  11. Try
  12. Dim qrCode As New QRCodeEncoder
  13. qrCode.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE
  14. qrCode.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.L
  15. Me.PictureBox1.Image = qrCode.Encode(Me.txtCode.Text, System.Text.Encoding.UTF8)
  16.  
  17.  
  18. Catch ex As Exception
  19. MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Information)
  20. End Try
  21. End Sub

And to export the QR Code as an Image and saving it automatically to the Documents Folder, this is the code I used.

  1. Private Sub btnExport_Click(sender As Object, e As EventArgs) Handles btnExport.Click
  2. Try
  3. If Me.PictureBox1.Image IsNot Nothing Then
  4. Me.PictureBox1.Image.Save(IO.Path.Combine(My.Computer.FileSystem.SpecialDirectories.MyDocuments, Me.txtCode.Text & ".jpg"))
  5. MessageBox.Show("QR is successfully saved.")
  6. End If
  7. Catch ex As Exception
  8. MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Information)
  9. End Try
  10. End Sub

How to Run

Requirements:
  • Download and Instal Microsoft Visual Studio Software.
  • Download the provided source code zip file. ( download button is located below )
Installation
  1. Extract the downloaded source code zip file.
  2. Locate the Solution file in the extracted source code. The file is known as "QR Code Generator.sln".
  3. Open the solution file with your MS Visual Studio Software.
  4. Press the "F5" key on your keyboard to run the Program.
DEMO

I hope this QR Code Generator Program will help you in your future projects.

For more additional information just contact me at my email: [email protected]

Enjoy :)

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment