T
thomasc1020
Hello,
I have a small problem playing with MSComm control in VB.NET 2003.
Below is the code I am working on.
Private Sub MSComm1_OnComm(ByVal sender As _
System.Object, ByVal e As System.EventArgs) Handles
MSComm1.OnComm
Do
Buffer = Buffer & MSComm1.Input
Loop Until InStr(Buffer, Chr(3))
Correct = InStr(Buffer, Hi")
If (Correct) Then
Dim Form2 As New Form
Form2.MdiParent = Me.MdiParent
Form2.Show()
End If
End Sub
What I want to do is this:
Once the process goes into the 'MSComm1_OnComm' block, it should
1> read the MSComm input and
2> check if it contains "Hi".
3> If it does, display Form2.
4> If it does not contain "Hi", wait for next input and repeat 1>-3>
Below is the cord I am working on.
For some reason I don't understand, it repeats the 'If ~ End If'
clause 24 times, displaying 24 new forms, before it exits the
'MSComm1_OnComm' block. I have no idea why it reapeats the 'If ~ End
If' clause 24 times.
Should I 'reset' the OnComm event in some way in order to exit the
OnComm procedure?
Or Can it be related to the syntax using Parent/Child Form?
I've been struggling with this problem for about 10 days already.
Please help.
I have a small problem playing with MSComm control in VB.NET 2003.
Below is the code I am working on.
Private Sub MSComm1_OnComm(ByVal sender As _
System.Object, ByVal e As System.EventArgs) Handles
MSComm1.OnComm
Do
Buffer = Buffer & MSComm1.Input
Loop Until InStr(Buffer, Chr(3))
Correct = InStr(Buffer, Hi")
If (Correct) Then
Dim Form2 As New Form
Form2.MdiParent = Me.MdiParent
Form2.Show()
End If
End Sub
What I want to do is this:
Once the process goes into the 'MSComm1_OnComm' block, it should
1> read the MSComm input and
2> check if it contains "Hi".
3> If it does, display Form2.
4> If it does not contain "Hi", wait for next input and repeat 1>-3>
Below is the cord I am working on.
For some reason I don't understand, it repeats the 'If ~ End If'
clause 24 times, displaying 24 new forms, before it exits the
'MSComm1_OnComm' block. I have no idea why it reapeats the 'If ~ End
If' clause 24 times.
Should I 'reset' the OnComm event in some way in order to exit the
OnComm procedure?
Or Can it be related to the syntax using Parent/Child Form?
I've been struggling with this problem for about 10 days already.
Please help.