Click to See Complete Forum and Search --> : PortOpen


pepin
August 29th, 2001, 09:24 AM
Hi!
I have the following problem with my code: when it goes through MSComm1.portopen=true, there is an error message "Port already open". If I step over that line, later, when the code is MSCOmm1.output=Chr$(stx),where Const stx=&H2, the error message is "Operation valid only when the port is open".
If I put my cursor over MScomm1.portopen, the variable is said to be False...I use the exact same code in an other form and it works very well.
Please help me!
Thanks


Valérie Pepin

Markus W.
August 30th, 2001, 12:51 AM
Maybe the COM port is used by another application (...or MSComm object in your app).

pepin
August 30th, 2001, 08:12 AM
So that means I can not use the MSComm control in 2 different forms within the same Project...?

Valérie Pepin

Markus W.
August 30th, 2001, 08:21 AM
You can do that, but you cannot open the same COM port with two
different MSComm controls.

Jason Thompson
December 24th, 2001, 01:15 PM
I dont know why it does it but i have had the same problem, It may be that we are both trying to write to the port outside a control. There is a good program at http://www.ontrak.net/visual.htm which a friend told me about and i have got this working
good luck
Jason

btpanek
December 25th, 2001, 01:48 PM
Unless you want to access two different serial ports at the same time, you should only have one MsComm control in your project. You may want to move this to a separate (non-visible) form which is loaded at the beginning of the program, and then not unloaded until you exit.