Programming VB.NET : QR Code Generator menggunakan VB.NET

1. Download file MessagingToolkit.QRCode.dll di https://osdn.net/projects/sfnet_qrreader/downloads/MessagingToolkit.QRCode.dll/
2. Buat project baru berisi :
    a. textbox
    b. picturebox
    c. button
    d. safefiledialog
3. Tambahkan MessagingToolkit.QRCode.dll ke Reference
4. Copy-Paste code dibawah ini

Public Class Form1
    Dim QR_Code As New MessagingToolkit.QRCode.Codec.QRCodeEncoder
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        Try
            PictureBox1.Image = QR_Code.Encode(TextBox1.Text)
        Catch ex As Exception

        End Try
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        SaveFileDialog1.ShowDialog()
    End Sub

    Private Sub SaveFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles SaveFileDialog1.FileOk
        Try
            Dim img As New Bitmap(PictureBox1.Image)
            img.Save(SaveFileDialog1.FileName, Imaging.ImageFormat.Jpeg)
        Catch ex As Exception

        End Try
    End Sub
End Class

Selesai

Leave a Reply

Your email address will not be published. Required fields are marked *