Click here to Skip to main content
15,918,617 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
Regarding SMS, through VB.net application, how can we send the SMS where a SMS device is Connected to USB Port. Anybody having the information please let me know?
Posted
Updated 28-Dec-10 19:12pm
v2

 
Share this answer
 
Comments
thatraja 29-Dec-10 2:18am    
Good answer abhinav
TRY this..

VB
Dim SMSEngine As New SMSCOMMS("COM4")

'the port needs to be initialised

SMSPort = New SerialPort
        With SMSPort
            .PortName = COMMPORT
            .BaudRate = 19200
            .Parity = Parity.None
            .DataBits = 8
            .StopBits = StopBits.One
            .Handshake = Handshake.RequestToSend
            .DtrEnable = True
            .RtsEnable = True
            .NewLine = vbCrLf
        End With


        'this is  the set of AT commands to be written on serial port

            SMSPort.WriteLine("AT")
            'set command message format to text mode(1)
            SMSPort.WriteLine("AT+CMGF=1" & vbCrLf)
            'set service center address (which varies for service providers (idea, airtel))
            SMSPort.WriteLine("AT+CSCA=""+919822078000""" & vbCrLf)
            ' enter the mobile number whom you want to send the SMS
            SMSPort.WriteLine("AT+CMGS=  + TextBox1.text + " & vbCrLf)
            _ContSMS = False
            SMSPort.WriteLine("+ TextBox1.text +" & vbCrLf & Chr(26)) 'SMS sending

    Dim i As Integer
    Private Sub Button1_Click(ByVal sender As System.Object,
       ByVal e As System.EventArgs) Handles Button1.Click

        SMSEngine.Open() 'open the port
        SMSEngine.SendSMS() 'send the SMS

    End Sub
 
Share this answer
 
Comments
trajanojunior2000 29-Nov-12 6:47am    
Hi,
I dont have class SMSCOMMS,
Please send for me the class SMSCOMMS,
trajanojunior2000@yahoo.com.br
Tnks.
J.Valmir Trajano Junior.
Md Manazir Hasan 14-Nov-14 2:19am    
Please send me the SMSCOMMS class at manazirhasan2003@gmail.com, thanks in advance

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900