QR Code with Website Url | VB.NETByteScout Barcode SDK

QR Code with Website Url | VB.NET

Module1.vb:

VB
Imports Bytescout.BarCode

Module Module1

    Sub Main()

        ' Create and activate barcode generator instance
        Using barcode As New Barcode("demo", "demo")

            ' Set barcode type
            barcode.Symbology = SymbologyType.QRCode

            ' Inputs
            Dim inpEmail = New QrCodeUrlTemplate With {
            .Url = "https://bytescout.com"
            }

            ' Set barcode value
            barcode.Value = inpEmail.ToString()

            ' Save generated barcode
            barcode.SaveImage("result.png")

            ' Open generated barcode image with associated application
            Process.Start("result.png")

        End Using

    End Sub

End Module

QrCodeUrlTemplate.vb:

VB
Public Class QrCodeUrlTemplate

#Region "Constructors"

    Public Sub New()
    End Sub

    Public Sub New(ByVal Url As String)
        Me.Url = Url
    End Sub

#End Region


#Region "Properties"

    Public Property Url As String

#End Region

#Region "Overloaded Methods"

    Public Overrides Function ToString() As String

        If String.IsNullOrEmpty(Url) Then Return MyBase.ToString()

        Return Url

    End Function

#End Region


End Class