Click here to Skip to main content
15,900,724 members
Please Sign up or sign in to vote.
2.86/5 (4 votes)
See more:
Hi All,

Regarding SMS, through VB6 application, how can we send the SMS where a SMS device is Connected to USB Port. Anybody having the information please let me know.

Regards,
Jay.
Posted

you will almost certainly need a third party library. I doubt anyone still writes or supports those for VB6 tho, given how out of date and obsolete it is

If VB6 can talk to a webservice, you may find a webservice you can use. I doubt it would be free.

 
Share this answer
 
Imports System
Imports System.Threading
Imports System.ComponentModel
Imports System.IO.Ports

Public Class Form1
'connect your mobile/GSM modem to PC,
'then go in device manager and check under ports which COM port has been slected
'if say com1 is there then put com2 in following statement
Dim SMSEngine As New SMSCOMMS("COM19")
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
End Class

Public Class 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
Public Event Sending(ByVal Done As Boolean)
Public Event DataReceived(ByVal Message As String)

Public Sub New(ByRef COMMPORT As String)
'initialize all values
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
End Sub

Public Function SendSMS() As Boolean
If SMSPort.IsOpen = True Then
'sending AT commands
SMSPort.WriteLine("AT")
SMSPort.WriteLine("AT+CMGF=1" & vbCrLf) 'set command message format to text mode(1)
SMSPort.WriteLine("AT+CSCA=""+919822078000""" & vbCrLf) 'set service center address (which varies for service providers (idea, airtel))
SMSPort.WriteLine("AT+CMGS= + TextBox1.text + " & vbCrLf) ' enter the mobile number whom you want to send the SMS
_ContSMS = False
SMSPort.WriteLine("+ TextBox1.text +" & vbCrLf & Chr(26)) 'SMS sending
MessageBox.Show(":send")
SMSPort.Close()
End If
End Function

Public Sub Open()
If Not (SMSPort.IsOpen = True) Then
SMSPort.Open()
End If
End Sub

Public Sub Close()
If SMSPort.IsOpen = True Then
SMSPort.Close()
End If
End Sub
End Class
 
Share this answer
 
Comments
CHill60 1-Mar-14 16:58pm    
Off topic
;P ;P ;P oh may god thats my midterm project her in sti
 
Share this answer
 
Jay, why on earth would you use VB6 ? You realise it's obsolete, unsupported, and unlikely to lead to any sort of real career opportunities ?

Because of COM, you can do anything in VB6. The kicker is, VB6 itself is useless, it just knows how to talk to real languages.

Did they even have SMS when VB6 was made obsolete ?
 
Share this answer
 
HI I have VB6 SMS Project Using GSM Modem....please contact boopasathya
 
Share this answer
 
Comments
sameershik 22-Nov-11 1:24am    
SENT ME SMS PROJECT chennaicity76@gmail.com
nuzleaf27 22-Aug-14 10:45am    
hello. I have the same problem with jayachandra.c .
Can you send me your SMS Project?

nuzleaf.haste27@gmail.com

thank you
Member 9521715 25-Feb-17 7:18am    
can you send me code of sms software at saaleh@tabeertours.com


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