Generate QR Code in VB.NET
I am Creating Windows application using VB.Net. In this Article you will learn about Generate QR Code in VB.NET.
I am Creating windows application in vb.net named Generate QR Code in VB.NET. In this application I am using MessagingToolkit.dll, one Textbox, one PictureBox, Three Button controls and One Labels.
I am using Following Controls and it's name
txt_QRcode.Text : It is used to Enter the QR Code.
pic_QRcode.Image : It is used to Display QR Code.
Btn_Generate : It is used to get the QR Code.
Btn_save : It is used to Save QR Code.
Btn_Clear : It is used to Clear QR Code
Step 1 => Import MessagingToolkit.dll
Download MessagingToolkit.dll
Imports MessagingToolkit.QRCode.Codec
Step 2 => QR Code Generate Code
Try
Dim qrCode As New QRCodeEncoder()
qrCode.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE
qrCode.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.L
pic_QRcode.Image = qrCode.Encode(txt_QRcode.Text, System.Text.Encoding.UTF8)
Catch ex As Exception
MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try
Step 3 => QR Code Save My Computer
SD.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.Desktop
SD.FileName = txt_barcode.Text
SD.SupportMultiDottedExtensions = True
SD.AddExtension = True
SD.Filter = "PNG File|*.png"
If SD.ShowDialog() = DialogResult.OK Then
Try
Pic_barcode.Image.Save(SD.FileName, Imaging.ImageFormat.Png)
Catch ex As Exception
End Try
End If
Step 4 => QR Code Clear
txt_QRcode.Clear()
pic_QRcode.Image = Nothing
txt_QRcode.Focus()
Thanks
Subscribe For More Projects...
0 Comments