serial port communication and visual basic

J

Thread Starter

jvbisuna

guys, can somebody please help me with my program...
<pre>
Option Explicit
Dim ReceivedData As String

Private Sub Form_Load()
MSComm1.CommPort = 7
MSComm1.Settings = "9600,N,8,1"
MSComm1.InputLen = 0
MSComm1.RThreshold = 1
MSComm1.PortOpen = True
ReceivedData = ""
End Sub


Private Sub MSComm1_OnComm()


If MSComm1.CommEvent = comEvReceive Then
ReceivedData = MSComm1.Input
If ReceivedData = "start" Then
Label1.Caption = "start"
Else
Label1.Caption = "wrong input"
End If

End Sub</pre>

there must be a display in the label containing the text that i sent once the text is received... but this is not working... is there still a need to use at commands and download a dll file?...

somebody please help me... thank u so much in advance! :)
 
I'm not familiar with the MSComm control, and I suggest you upgrade to the .net languages since VB6 is very out of date, unless this is a legacy project you are maintaining.

Are you receiving serial events at all, or just getting wrong data? Is MSComm1.Input a character, a terminated line, etc? Some of these controls, like the newer serial port control for C# and VB.NET have ways of accessing characters in the receive buffer as well as reading in a whole line, usually terminated by a carriage return and/or a line feed. I know of the newer control you can specify what the line end is which is essential to match it up with your sending device.

KEJR
 
Top