Link Search Menu Expand Document

QR Code With Email - VB.NET

BarCode SDK sample in VB.NET demonstrating ‘QR Code With Email’

Module1.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 QrCodeEmailTemplate With {
            .Email = "sample@email.com",
            .Subject = "Hello There!",
            .Message = "Sample message goes here..."
            }

            ' 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

QrCodeEmailTemplate.vb
Public Class QrCodeEmailTemplate

#Region "Constructors"

    Public Sub New()
    End Sub

    Public Sub New(ByVal Email As String, ByVal Subject As String, ByVal Message As String)
        Me.Email = Email
        Me.Subject = Subject
        Me.Message = Message
    End Sub

#End Region


#Region "Properties"

    Public Property Email As String
    Public Property Subject As String
    Public Property Message As String

#End Region

#Region "Overloaded Methods"

    Public Overrides Function ToString() As String

        If String.IsNullOrEmpty(Email) AndAlso String.IsNullOrEmpty(Subject) AndAlso String.IsNullOrEmpty(Message) Then Return MyBase.ToString()

        Return $"MATMSG:TO:

{Email};

SUB:

{Subject}

BODY:

{Message}
;;"

    End Function

#End Region


End Class

Download Source Code (.zip)

Return to the previous page Explore BarCode SDK


Copyright © 2016 - 2021 ByteScout