Click here to Skip to main content
15,889,116 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to send SMS automatically to multiple numbers form database. I am using SIM900 GSM module.

With ny below code I am able to do so, but using a message dialog, now how can I do it with message dialog.I need to send sms to all the mobile numbers automatically without user intervention.

Thanks in advance, Anyone can help.

What I have tried:

For i As Integer = 0 To mobNo.Rows.Count - 1
                       mobnos = mobNo.Rows(i)(0)
                       MessageBox.Show(mobnos & "==>" & avgSMS)

                       SerialPort1.Write("AT" & vbCrLf)
                       System.Threading.Thread.Sleep(200)
                       SerialPort1.Write("AT+CMGF=1" & vbCrLf)
                       System.Threading.Thread.Sleep(200)
                       SerialPort1.Write("AT+CMGS=" & Chr(34) & mobnos & Chr(34) & vbCrLf)
                       System.Threading.Thread.Sleep(200)
                       SerialPort1.Write(avgSMS & Chr(26))
                       System.Threading.Thread.Sleep(400)
                       'MsgBox("Sent")


                   Next
Posted
Updated 27-Jan-18 23:08pm

1 solution

Take out the line:
MessageBox.Show(mobnos & "==>" & avgSMS)
 
Share this answer
 
Comments
ramen79 28-Jan-18 9:14am    
I have tried, it only sendsms to the 1st number.
OriginalGriff 28-Jan-18 10:04am    
Then use the debugger and find out exactly what is going on. How many times does it go round the loop for example. What's in mobNo.Rows would be worth looking at as well.

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