Programming Tutorials

Send SMS using VB code

By: Emiley J in VB.net Tutorials on 2009-03-16  

If you are looking for a simple program to send SMS from your PC using VB then here is the code.

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub Form_Load()
'Change this with the Baud rate of your modem (The one you use with Hyper Terminal)
MSComm1.Settings="9600,n,8,1"        
' Change this with the port your Modem is attached 
MSComm1.CommPort=1                     
MSComm1.PortOpen=TRUE            

End Sub

Private Sub Command1_Click()
'This line can be removed if your modem will always be in Text Mode...
MSComm1.Output = "AT+CMGF=1" & vbCrLf                          
Sleep 500
'Replace this with your mobile Phone's No.
MSComm1.Output = "AT+CMGS=+91232538538" & vbCrLf       
Sleep 1000
MSComm1.Output = "Hello This is my test message"
Sleep 2000
If InStr(MSComm1.Input, "OK") Then
    MsgBox "Message Send"
Else
    MsgBox "Message Not Send"
End If

End Sub





Add Comment

* Required information
1000

Comments

No comments yet. Be the first!

Most Viewed Articles (in VB.net )

Latest Articles (in VB.net)