MS Comm Control won't close port 
Author Message
 MS Comm Control won't close port

I have encountered what appears to be a bug in the MSComm control
included in the VB 4.0a CD release.

When the port is open, I close it (by setting the PortOpen property to
False), then attempt to reopen it less than a second or so later (by
setting the PortOpen property to True), and I get a runtime error that
says the "Port is already open".  

I verified that the PortOpen property is, indeed, returning a "False"
value before I set it to "True".

Has anyone encountered this behavior--and is there a workaround?  I need
to frequently open and close the port so it can be shared with another
process.

I'm using Version 1.0.2805 of MSCOMM32.OCX.

Thanks in advance!

 --Matt Thomas
   Codesmith, Inc.



Sun, 08 Aug 1999 03:00:00 GMT  
 MS Comm Control won't close port

I think you may have to:

   On Error GoTo Retry
   If MSComm1.PortOpen = False Then MSComm1.PortOpen = True
   'etc.
   Exit Sub

   Retry:
   If Err = 68 Then
       DoEvents
       DoEvents
       Resume
   Else
       MsgBox Error$
       Resume Next
   End If
End Sub
--
{*filter*} Grier
Hard & Software
12962 West Louisiana Avenue
Lakewood, CO  80228
303-986-2179 (voice)
303-986-3143 (fax)




Sun, 08 Aug 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Tip : VB.NET Form Won't Close on Me.Close + User Controls

2. Stream input from COM port using MS COMM control: example requested

3. How to loop comm port control to read text files through serial port in VB3

4. Comm Ports in 2.0 & Win 98

5. Closing the comm port

6. Closing Comm Port with Sportster 28.8K (MSCOMM)

7. Closing Comm Port with Sportster 28.8 (MSCOMM)

8. Closing Comm Port with Sportster (MSCOMM)

9. Determing Comm Ports - Win 3.1, WinNT, Win95

10. Closing a COMM Port

11. Comm Port Open/Close question

12. Ctrl-F4 won't close child windows in VB5 with some controls

 

 
Powered by phpBB® Forum Software