Step 1: Click New Project, then select Visual Basic on the left, then Windows and then select Windows Forms Application. Name your project "WhatsAppVB.Net" and then click OK
Step 2: Download WhatsApp API. This is an API written in C# but it can be used in any .NET language. It's a fork from WhatsAPINet, which is based on Chat API
Step 3: Design your form as below

Step 4: Add a click event handler to the button
Imports System.Threading
Imports WhatsAppApi
Imports WhatsAppApi.ApiBase
Imports WhatsAppApi.Helper
Public Class Form1
Private wa As WhatsApp
Private Delegate Sub UpdateTextBox(ByVal textbox As TextBox, ByVal value As String)
Public Sub UpdateDataTextBox(ByVal textbox As TextBox, ByVal value As String)
Dim box As TextBox = textbox
box.Text = (box.Text & value)
End Sub
Private Sub btnSend_Click(sender As Object, e As EventArgs) Handles btnSend.Click
If ((Not String.IsNullOrEmpty(Me.txtMessage.Text) AndAlso (Not Me.wa Is Nothing)) AndAlso (Me.wa.ConnectionStatus = CONNECTION_STATUS.LOGGEDIN)) Then
Me.wa.SendMessage(Me.txtTo.Text, Me.txtMessage.Text)
Dim txtStatus As TextBox = Me.txtStatus
txtStatus.Text = (txtStatus.Text & String.Format(Environment.NewLine & "{0}:{1}", txtName.Text, Me.txtMessage.Text))
Me.txtMessage.Clear()
Me.txtMessage.Focus()
End If
End Sub
Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
Dim thread = New Thread(AddressOf ThreadTask)
thread.IsBackground = True
thread.Start()
End Sub
Private Sub ThreadTask()
Dim textbox As UpdateTextBox = New UpdateTextBox(AddressOf Me.UpdateDataTextBox)
Me.wa = New WhatsApp(Me.txtPhoneNumber.Text, Me.txtPassword.Text, Me.txtName.Text, True, False)
AddHandler Me.wa.OnConnectSuccess, Sub()
If Me.txtStatus.InvokeRequired Then
Dim objArray1 As Object() = New Object() {Me.txtStatus, "Connected..."}
Me.Invoke(textbox, objArray1)
End If
AddHandler Me.wa.OnLoginSuccess, Sub(ByVal phone As String, ByVal data As Byte())
If Me.txtStatus.InvokeRequired Then
Dim args As Object() = New Object() {Me.txtStatus, Environment.NewLine & "Login success !"}
Me.Invoke(textbox, args)
End If
While Me.wa IsNot Nothing
Me.wa.PollMessages()
Thread.Sleep(200)
Continue While
End While
End Sub
AddHandler Me.wa.OnLoginFailed, Sub(ByVal data As String)
If Me.txtStatus.InvokeRequired Then
Dim args As Object() = New Object() {Me.txtStatus, String.Format(Environment.NewLine & "Login failed: {0}", data)}
Me.Invoke(textbox, args)
End If
End Sub
AddHandler Me.wa.OnGetMessage, Sub(ByVal node As ProtocolTreeNode, ByVal from As String, ByVal id As String, ByVal name As String, ByVal message As String, ByVal receipt_sent As Boolean)
If Me.txtStatus.InvokeRequired Then
Dim args As Object() = New Object() {Me.txtStatus, String.Format(Environment.NewLine & "{0}:{1}", name, message)}
Me.Invoke(textbox, args)
End If
End Sub
Me.wa.Login(Nothing)
End Sub
AddHandler Me.wa.OnConnectFailed, Sub(ByVal ex As Exception)
If Me.txtStatus.InvokeRequired Then
Dim args As Object() = New Object() {Me.txtStatus, String.Format(Environment.NewLine & "Connect failed: {0}", ex.StackTrace)}
Me.Invoke(textbox, args)
End If
End Sub
Me.wa.Connect()
End Sub
End Class
VIDEO TUTORIALS