•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 456,593 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,534 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums
Views: 71725 | Replies: 30
![]() |
•
•
Join Date: Oct 2006
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
•
•
•
•
hi, im new to vb.net and recently i am doing a web application on sending sms. anyone has got any codes for sending sms using vb.net?
or does anyone know where i can get relevant info for it.
I'm currently in the process of developing an VB.NET application that uses SMS. The absolute easiest way of doing this is to use an SMS gateway service such as ClickaTell to handle the actual bidirectional delivery. Using a gateway will allow you to deliver and recieve messages to/from many mobile networks and will greatly simplify your application development.
Hope this helps...
Anthony Papillion
Mobile Text Solutions
www.mobiletextsolutions.com
•
•
Join Date: May 2007
Posts: 18
Reputation:
Rep Power: 2
Solved Threads: 0
Yes you can send SMS from many mobile phones using your PC. But not all mobiles support that. You will have to check by connecting the mobile to your PC using its data cable and trying the command AT on it using hyper terminal.
There are many AT commands.
To send SMS you can can use
AT+CMGS=<number>
<message>ctrl+z
To read sms from inbox you can use
AT+CMGR=<address>
address is the location number, can be 1, 2... etc.
There are commands for almost everything you can do with the phone.
Before attempting this make sure that you are skillled in serial port programming.
There are many AT commands.
To send SMS you can can use
AT+CMGS=<number>
<message>ctrl+z
To read sms from inbox you can use
AT+CMGR=<address>
address is the location number, can be 1, 2... etc.
There are commands for almost everything you can do with the phone.
Before attempting this make sure that you are skillled in serial port programming.
•
•
Join Date: Jul 2007
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 1
Hello guyz...i need your advices for which method to use for sending SMS using .NET.
DO I USE THE SMPP (to access to the sever)?
or I USE THE WEB SERVICE PROVIDERS???
Thanks...
and for all the folks who want a piece of code...
Here's what ive done so far (i also need your feedbacks):
THANKS. assaf.rawad@gmail.com
DO I USE THE SMPP (to access to the sever)?
or I USE THE WEB SERVICE PROVIDERS???
Thanks...
and for all the folks who want a piece of code...
Here's what ive done so far (i also need your feedbacks):
private void Send_Click(object sender, System.EventArgs e)
{
try
{
SmsTest.com.webservicex.www.SendSMSWorld smsWorld =
new SmsTest.com.webservicex.www.SendSMSWorld();
smsWorld.sendSMS(txtEmailId.Text.Trim(),
txtCountryCode.Text.Trim(),
txtMobileNo.Text.Trim(), txtMessage.Text);
lblMessage.Visible = true;
lblMessage.Text="Message Send Succesfully";
}
catch(Exception ex)
{
lblMessage.Visible = true;
lblMessage.Text="Error in Sending message"+ex.ToString();
}
}
•
•
Join Date: Sep 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
hi there
for sending sms to mobiles first of all you must select a protocol like SMTP/SMPP/HTTP. and for more details log on to www.planetsourcecode.com
yor techie
for sending sms to mobiles first of all you must select a protocol like SMTP/SMPP/HTTP. and for more details log on to www.planetsourcecode.com
yor techie
•
•
Join Date: Sep 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hi,
Im from philippines and i have a fargo maestro 100.
I want to maximize its usage but i dont actually how.
can you teach me?
Anyways thanks for posting, this really a big help.
Thanks.
ajektus
Philippines
Im from philippines and i have a fargo maestro 100.
I want to maximize its usage but i dont actually how.
can you teach me?
Anyways thanks for posting, this really a big help.
Thanks.
ajektus
Philippines
•
•
•
•
HI,
Here is code for a dll file for VB.NET 2005 that I am currently using to send SMS Messages. Receiving SMS Messages are not done yet, but I will post it when it is done. This Code will work with FARGO Maestro 100 GSM Modem (WAVECOM)
Please note that this code use threading ...
Option Explicit On Imports System Imports System.Threading Imports System.ComponentModel Imports System.Windows.Forms Imports System.IO.Ports PublicClass SMSCOMMS Private WithEvents SMSPort As SerialPort Private SMSThread As Thread Private ReadThread As Thread Shared _Continue As Boolean = False Shared _ContSMS As Boolean = False Private _Wait As Boolean = False Shared _ReadPort As Boolean = False Private WithEvents DBServer As Postgres Public Event Sending(ByVal Done As Boolean) Public Event DataReceived(ByVal Message As String) Public Sub New(ByRef COMMPORT As String) SMSPort = New SerialPort With SMSPort .PortName = COMMPORT .BaudRate = 9600 .Parity = Parity.None .DataBits = 8 .StopBits = StopBits.One .Handshake = Handshake.RequestToSend .DtrEnable = True .RtsEnable = True .NewLine = vbCrLf End With DBServer = New Postgres() ReadThread = New Thread(AddressOf ReadPort) End Sub Public Function SendSMS(ByVal CellNumber As String, ByVal SMSMessage As String) As Boolean Dim MyMessage As String = Nothing ' 'Check if Message Length <= 160 If SMSMessage.Length <= 160 Then MyMessage = SMSMessage Else MyMessage = Mid(SMSMessage, 1, 160) End If 'MsgBox("Sending " & MyMessage & " to " & CellNumber) If IsOpen = True Then SMSPort.WriteLine("AT+CMGS=" & CellNumber & vbCr) _ContSMS = False While _ContSMS = False Application.DoEvents() End While SMSPort.WriteLine(MyMessage & vbCrLf & Chr(26)) _Continue = False RaiseEvent Sending(False) End If End Function Private Sub ReadPort() Dim SerialIn As String = Nothing Dim RXBuffer(SMSPort.ReadBufferSize) As Byte Dim SMSMessage As String = Nothing Dim Strpos As Integer = 0 Dim TmpStr As String = Nothing While SMSPort.IsOpen = True If (SMSPort.BytesToRead <> 0) And (SMSPort.IsOpen = True) Then While SMSPort.BytesToRead <> 0 SMSPort.Read(RXBuffer, 0, SMSPort.ReadBufferSize) 'SMSPort.BytesToRead SerialIn = SerialIn & System.Text.Encoding.ASCII.GetString(RXBuffer) ' Handle Internal Events ' For Received Characters If SerialIn.Contains(">") = True Then _ContSMS = True End If If SerialIn.Contains("+CMGS:") = True Then _Continue = True RaiseEvent Sending(True) _Wait = False SerialIn = String.Empty ReDim RXBuffer(SMSPort.ReadBufferSize) End If End While RaiseEvent DataReceived(SerialIn) SerialIn = String.Empty ReDim RXBuffer(SMSPort.ReadBufferSize) End If End While End Sub Public ReadOnly Property IsOpen() As Boolean Get If SMSPort.IsOpen = True Then IsOpen = True Else IsOpen = False End If End Get End Property Public Sub Open() If IsOpen = False Then SMSPort.Open() ReadThread.Start() End If End Sub Public Sub Close() If IsOpen = True Then SMSPort.Close() End If End Sub EndClass
Usage Of The Above Code Should be straight Forward, But Here Goes
In a Windows Form App
Option Explicit On 'Other Imports Imports SMSCOMMS ' Rest of stuff 'Declarations Public WitheEvents SMSEngine as SMSCOMMS Public Sub Main() SMSEngine = New SMSCOMMS("COM1") SMSEngine.Open() SMSEngine.SendSMS("000000000","THIS IS YOUR MESSAGE") End Sub Public Sub Form_Close() SMSEngine.Close() End Sub
I Hope this helps
•
•
Join Date: Jan 2008
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
hi, i Saw ur Code to Send Message Using AT Command .Can u Pls Help me?
i m Working on Vb.net.
i want to Store Message in Variable When Any New Message Arrive On Hyperterminal.
and
How Can i Run Multiple AT commands together in vb.net?
pls friend help me.
if u Have and Code in vb.net to Recieve Message from port then Pls send me .........
thanx in Advance
i m Working on Vb.net.
i want to Store Message in Variable When Any New Message Arrive On Hyperterminal.
and
How Can i Run Multiple AT commands together in vb.net?
pls friend help me.
if u Have and Code in vb.net to Recieve Message from port then Pls send me .........
thanx in Advance
•
•
•
•
HI,
Here is code for a dll file for VB.NET 2005 that I am currently using to send SMS Messages. Receiving SMS Messages are not done yet, but I will post it when it is done. This Code will work with FARGO Maestro 100 GSM Modem (WAVECOM)
Please note that this code use threading ...
Option Explicit On Imports System Imports System.Threading Imports System.ComponentModel Imports System.Windows.Forms Imports System.IO.Ports PublicClass SMSCOMMS Private WithEvents SMSPort As SerialPort Private SMSThread As Thread Private ReadThread As Thread Shared _Continue As Boolean = False Shared _ContSMS As Boolean = False Private _Wait As Boolean = False Shared _ReadPort As Boolean = False Private WithEvents DBServer As Postgres Public Event Sending(ByVal Done As Boolean) Public Event DataReceived(ByVal Message As String) Public Sub New(ByRef COMMPORT As String) SMSPort = New SerialPort With SMSPort .PortName = COMMPORT .BaudRate = 9600 .Parity = Parity.None .DataBits = 8 .StopBits = StopBits.One .Handshake = Handshake.RequestToSend .DtrEnable = True .RtsEnable = True .NewLine = vbCrLf End With DBServer = New Postgres() ReadThread = New Thread(AddressOf ReadPort) End Sub Public Function SendSMS(ByVal CellNumber As String, ByVal SMSMessage As String) As Boolean Dim MyMessage As String = Nothing ' 'Check if Message Length <= 160 If SMSMessage.Length <= 160 Then MyMessage = SMSMessage Else MyMessage = Mid(SMSMessage, 1, 160) End If 'MsgBox("Sending " & MyMessage & " to " & CellNumber) If IsOpen = True Then SMSPort.WriteLine("AT+CMGS=" & CellNumber & vbCr) _ContSMS = False While _ContSMS = False Application.DoEvents() End While SMSPort.WriteLine(MyMessage & vbCrLf & Chr(26)) _Continue = False RaiseEvent Sending(False) End If End Function Private Sub ReadPort() Dim SerialIn As String = Nothing Dim RXBuffer(SMSPort.ReadBufferSize) As Byte Dim SMSMessage As String = Nothing Dim Strpos As Integer = 0 Dim TmpStr As String = Nothing While SMSPort.IsOpen = True If (SMSPort.BytesToRead <> 0) And (SMSPort.IsOpen = True) Then While SMSPort.BytesToRead <> 0 SMSPort.Read(RXBuffer, 0, SMSPort.ReadBufferSize) 'SMSPort.BytesToRead SerialIn = SerialIn & System.Text.Encoding.ASCII.GetString(RXBuffer) ' Handle Internal Events ' For Received Characters If SerialIn.Contains(">") = True Then _ContSMS = True End If If SerialIn.Contains("+CMGS:") = True Then _Continue = True RaiseEvent Sending(True) _Wait = False SerialIn = String.Empty ReDim RXBuffer(SMSPort.ReadBufferSize) End If End While RaiseEvent DataReceived(SerialIn) SerialIn = String.Empty ReDim RXBuffer(SMSPort.ReadBufferSize) End If End While End Sub Public ReadOnly Property IsOpen() As Boolean Get If SMSPort.IsOpen = True Then IsOpen = True Else IsOpen = False End If End Get End Property Public Sub Open() If IsOpen = False Then SMSPort.Open() ReadThread.Start() End If End Sub Public Sub Close() If IsOpen = True Then SMSPort.Close() End If End Sub EndClass
Usage Of The Above Code Should be straight Forward, But Here Goes
In a Windows Form App
Option Explicit On 'Other Imports Imports SMSCOMMS ' Rest of stuff 'Declarations Public WitheEvents SMSEngine as SMSCOMMS Public Sub Main() SMSEngine = New SMSCOMMS("COM1") SMSEngine.Open() SMSEngine.SendSMS("000000000","THIS IS YOUR MESSAGE") End Sub Public Sub Form_Close() SMSEngine.Close() End Sub
I Hope this helps
•
•
Join Date: Mar 2007
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
Hi,
There is some sample code for sending an SMS via VB.NET, if you go to www.freebiesms.co.uk, click "Custom Development", then "developers", it shows you how
Dan.
There is some sample code for sending an SMS via VB.NET, if you go to www.freebiesms.co.uk, click "Custom Development", then "developers", it shows you how
Dan.
![]() |
•
•
•
•
•
•
•
•
DaniWeb VB.NET Marketplace
- sending sms (ASP.NET)
- Sending sms via asp..net (VB.NET)
- Need Suggestion regarding sending sms through asp.net app (ASP.NET)
Other Threads in the VB.NET Forum
- Previous Thread: Error:Occured
- Next Thread: Generate code Program Help



Linear Mode