He did say that he just wanted to receive and display these values. No need to have anything other than the buffer declared as form level var or static.
Printable View
He did say that he just wanted to receive and display these values. No need to have anything other than the buffer declared as form level var or static.
so there is nothing missing in the code, like "If Len(RLine) > 1"?
Your right I will manipulate the data later into an equation and output the result of that equation, but for now I will test the data first by displaying it.
I tried it but there is no output in the text box. WHat could be wrong? is it the settings of the com or the code it self?
place a break point in the on comm event and see if you get there
what do you mean by break point?
can you show me the codes
It is not code it is a basic debugging method. Click off to the left of a line of code or position your cursor on a line of code and hit F9. This will set a break point on that line. When the program is ran an comes to that line it will stop and you can see what the value of your vars are as well as confirm the code is being executed.
It is starting to seem like you have 0 experience writing and testing code. You really need to play around with it a bit rather than try to get someone to give you 100% working code as you will never learn anything that way.
I thought its a code because there is a break in c programming. anyway in the code a(0) is directly equated to a textbox, should I equate it to a variable first like num1?.
I did it, I break point the line, how to see the value? will it just popup?
place you mouse cursor over the var that you would like to check
keep in mind it has to be one where that was set prior to the current line
what do you mean? I just placed the mouse cursor on the line after I break point but nothing happens
Clearly you did not try very much or you would have saw what I mean.
Run the projram, when it hits the break point the program will stop and the current line will be highlighted. move your mouse over a var in the current line or one of the previous lines and you will see the value of the var.
Again this is basic debugging and you need to play around with this stuff in order to fully understand it. Same is true for the code you have been given here in this thread you need to play around make changes and see what happens so you actually understand how to do it yourself.
Still I did not any value when I place the mouse cursor in the var.
How the the comport by the way should I just leave it open?
Did the code hit the break point?
Which var(s) did you try to test?
Not sure what you mean by just leave it open. Clearly you can not receive any data via a closed port. Still you need to close the port when you are done with it. In many cases this would be when you close the program. In others it would be when you are done receiving data.
Show us the code you are using.
Show us where you put the break point.
What is your RThreshold setting on your MSComm control?
I did not set the RThreshold yet. What should be its setting?
I put the breakpoint in this part:
"Text1.Text = a(0) 'get first number" of the code.
from this code
Private Sub MSComm1_OnComm()
Dim p%
Static RLine$
RLine = RLine + MSComm1.Input
p = Instr(RLine, vbCr)
If p Then ' a complete record with three numbers has been received now
dim a$()
a = Split(Left$(RLine,p-1), "/") 'split the line into the three numbers
If UBound(a) = 2 Then
Text1.Text = a(0) 'get first number
Text2.Text = a(1) 'get second number
Text3.Text = a(2) 'get third number
End If
RLine = Mid$(RLine,p+1) 'reset the receiver variable for the next line
End If
End Sub