J
Jeff
<p>I am trying to use two serial ports (and perhaps more) on the same form with VB6, I have no problems getting one MSComm event defined and working but when I try to add the second I get a "duplicate Definition" error. Any ideas as to why this wont work for me?
<p>This code works great:
<pre>
Dim WithEvents MSCommRatio1 As MSCommLib.MSComm
Private Sub Form_Open(Cancel As Integer)
'code to load the form and
'set up the comm
'port,
End Sub
Private Sub MSCommRatio1_OnComm()
'code to read the port at the correct time.
'and put the data were I want it
End Sub
</pre>
<p>This code gives the error:
<pre>
Dim WithEvents MSCommRatio1 As MSCommLib.MSComm
Dim WithEvents MSCommRatio2 As MSCommLib.MSComm
Private Sub Form_Open(Cancel As Integer)
'code to load the form and set up
'the comm objects on two different ports
End Sub
Private Sub MSCommRatio1_OnComm()
'code to read the port at the correct time.
'and put the data were I want it
End Sub
Private Sub MSCommRatio2_OnComm()
'code to read the port at the correct time.
'and put the data were I want it
End Sub
</pre>
<p>This code works great:
<pre>
Dim WithEvents MSCommRatio1 As MSCommLib.MSComm
Private Sub Form_Open(Cancel As Integer)
'code to load the form and
'set up the comm
'port,
End Sub
Private Sub MSCommRatio1_OnComm()
'code to read the port at the correct time.
'and put the data were I want it
End Sub
</pre>
<p>This code gives the error:
<pre>
Dim WithEvents MSCommRatio1 As MSCommLib.MSComm
Dim WithEvents MSCommRatio2 As MSCommLib.MSComm
Private Sub Form_Open(Cancel As Integer)
'code to load the form and set up
'the comm objects on two different ports
End Sub
Private Sub MSCommRatio1_OnComm()
'code to read the port at the correct time.
'and put the data were I want it
End Sub
Private Sub MSCommRatio2_OnComm()
'code to read the port at the correct time.
'and put the data were I want it
End Sub
</pre>