JOIN DEVPPL

It looks like you are new here. If you want to get involved, click on Join below!



receive sms and read it directly on Richtextbox.


M

keyboard_arrow_up
0
keyboard_arrow_down


First Post Mark as Spam miguelcalleja
Posts: 5 - Registered: 2013-05-07 00:36:25

hey guys can someone help me on my project? i want to receive and read sms on Richtextbox. I tried this code but it does'nt work.

here is the code.

With srPort
.ReadTo("AT" & ControlChars.CrLf)
s = .ReadLine
Debug.WriteLine(s)
.ReadTo("AT+CMGF=1" & Chr(34) & ControlChars.CrLf)
s = .ReadLine
Debug.WriteLine(s)
.ReadTo("AT+CMGR=1" & Chr(34) & ControlChars.CrLf & receiveRT.Text)
s = .ReadLine
Debug.WriteLine(s)

End With

can someone help me correct this codes? by the way i am using visual basic 2010.




T

keyboard_arrow_up
0
keyboard_arrow_down


Reply #1 Mark as Spam tejasvisuryawanshi
Posts: 23 - Registered: 2013-05-02 00:28:43

Hi, Miguel try to use this code.

Public Sub receive()
If srPort.IsOpen = True Then
Try

With srPort
.WriteLine("AT")
.WriteLine("AT+CMGF=1" & Chr(34) & vbCrLf)
.WriteLine("AT+CSCS=""PCCP437""" & Chr(34) & vbCrLf)
.WriteLine("AT+CPMS=""SM""" & Chr(34) & vbCrLf)
.WriteLine("AT+CMGL=""REC UNREAD""" & receiveRT.Text & vbCrLf)


End With
Catch ex As Exception

End Try

End If
End Sub

End If
End Sub




M

keyboard_arrow_up
0
keyboard_arrow_down


Reply #2 Mark as Spam miguelcalleja
Posts: 5 - Registered: 2013-05-07 00:36:25

thanks sir i'll try it




M

keyboard_arrow_up
0
keyboard_arrow_down


Reply #3 Mark as Spam miguelcalleja
Posts: 5 - Registered: 2013-05-07 00:36:25

thanks sir i'll try it




M

keyboard_arrow_up
0
keyboard_arrow_down


Reply #4 Mark as Spam miguelcalleja
Posts: 5 - Registered: 2013-05-07 00:36:25

Quoted text
Hi, Miguel try to use this code.

Public Sub receive()
If srPort.IsOpen = True Then
Try

With srPort
.WriteLine("AT")
.WriteLine("AT+CMGF=1" & Chr(34) & vbCrLf)
.WriteLine("AT+CSCS=""PCCP437""" & Chr(34) & vbCrLf)
.WriteLine("AT+CPMS=""SM""" & Chr(34) & vbCrLf)
.WriteLine("AT+CMGL=""REC UNREAD""" & receiveRT.Text & vbCrLf)


End With
Catch ex As Exception

End Try

End If
End Sub

End If
End Sub



it did not work...




T

keyboard_arrow_up
0
keyboard_arrow_down


Reply #5 Mark as Spam tejasvisuryawanshi
Posts: 23 - Registered: 2013-05-02 00:28:43

Private Sub Form_Load()
With MSComm1
.Handshaking = comNone
'make sure the serial port is not open (by this program)
If .PortOpen Then .PortOpen = False
'set the active serial port
.CommPort = 2
'set the badurate,parity,databits,stopbits for the connection
.Settings = "9600,N,8,1"
'set the DRT and RTS flags
.DTREnable = True
.RTSEnable = True
'enable the oncomm event for every reveived character
.RThreshold = 1
'disable the oncomm event for send characters
.SThreshold = 0
'open the serial port
.PortOpen = True
End With 'MSComm1

End Sub

Private Sub MSComm1_OnComm()
Select Case MSComm1.CommEvent
Case comEvRecieve
MSComm1.Output = "AT+CMGF=1" & Chr$(13)
MSComm1.Output = "AT+CNMI=1,2,0,0,0 " & Chr$(13)
MSComm1.Output = "AT+CMGR=1" & Chr$(13)
Do
DoEvents
buffer$ = buffer$ & MSComm1.Input
buffer$ = ""

Sleep 1000
msg = msg & MSComm1.Input

Text1.Text = msg
End Sub




M

keyboard_arrow_up
0
keyboard_arrow_down


Reply #6 Mark as Spam miguelcalleja
Posts: 5 - Registered: 2013-05-07 00:36:25

Quoted text
Private Sub Form_Load()
With MSComm1
.Handshaking = comNone
'make sure the serial port is not open (by this program)
If .PortOpen Then .PortOpen = False
'set the active serial port
.CommPort = 2
'set the badurate,parity,databits,stopbits for the connection
.Settings = "9600,N,8,1"
'set the DRT and RTS flags
.DTREnable = True
.RTSEnable = True
'enable the oncomm event for every reveived character
.RThreshold = 1
'disable the oncomm event for send characters
.SThreshold = 0
'open the serial port
.PortOpen = True
End With 'MSComm1

End Sub

Private Sub MSComm1_OnComm()
Select Case MSComm1.CommEvent
Case comEvRecieve
MSComm1.Output = "AT+CMGF=1" & Chr$(13)
MSComm1.Output = "AT+CNMI=1,2,0,0,0 " & Chr$(13)
MSComm1.Output = "AT+CMGR=1" & Chr$(13)
Do
DoEvents
buffer$ = buffer$ & MSComm1.Input
buffer$ = ""

Sleep 1000
msg = msg & MSComm1.Input

Text1.Text = msg
End Sub


sir i appreciate your effort but, the code is for vb6.0 but i need is for 2010. please sir help me...






JOIN DEVPPL

It looks like you are new here. If you want to get involved, click on Join below!




MENU
Advertising