VB 6.0 code example

ViaNett provides you with code examples to help you connect to our gateway using the programming language of your choice. You are welcome to try these scripts. Sign up now to get 5 free SMS.

What is VB 6.0?

Visual Basic (VB) is the third-generation event-driven programming language and integrated development environment (IDE) from Microsoft for its COM programming model. VB is also considered a programming language that is relatively easy to learn and use, because of its graphical development features and BASIC heritage.

Read more about Visual Basic 6.0 on Microsoft's resource center.

VB 6.0 Code example

To download this package, simply register for free and get 5 free SMS.

Private WithEvents mySMSConnection As ViaNett.SMSClient_v2_6
 
Private Sub Form_Load()
    Set mySMSConnection = New ViaNett.SMSClient_v2_6
 
    Dim ConnectionOk As Boolean
    ConnectionOk = mySMSConnection.Connect("yap.vianett.no", 31337, txt_username.Text, txt_password.Text)
    
    if ConnectionOk= false then
                MsgBox "Connection failed when connecting to ViaNett."
                exit sub
    end if
 
    Dim mySMS As sendSMSType
    mySMS.msgID = mySMSConnection.getNextMsgId
    mySMS.Tel = xxxxxxxxxx
    mySMS.msg = "Hello World"
        
    Dim SendOk As Boolean
    SendOk = mySMSConnection.sendSMS(mySMS)
    If SendOk Then
        MsgBox "Message with id=" & mySMS.msgID & " is successfully submitted to ViaNett."
    Else
        MsgBox "Message with id=" & mySMS.msgID & " failed when submitting to ViaNett."
    End If
        
End Sub
 
Sub mySMSConnection_ReceiveMsg(ByRef mySMS As receiveSMSType)
   MsgBox "Message Received: Tlf=" & mySMS.Tel & " msg=" & mySMS.msg
End Sub
 
Sub mySMSConnection_ReceiveDelivery(ByRef myDelivery As SMSDeliveryType)
    If myDelivery.ok Then
        MsgBox "Delivery: Message with id=" & myDelivery.msgID & " was sent sucessfully. The statuscode was " & myDelivery.ErrorCode
    Else
        MsgBox "Delivery: Message with id=" & myDelivery.msgID & " failed. The errorcode was " & myDelivery.ErrorCode
    End If
End Sub

Download source code

You need to log in to download the source code. Sign up now and get 5 free SMS messages.

Download the example code shown on this page.
Click here to download example code.

Download complete client example with windows forms and GUI interface.
Click here to download the source code.