Member Login
Search
Jump to a Date
Sponsored Communities
Cool stuff
Twitter Feed
Neat Stuff

Visit our shop for nerds in control lifestyle products.
Thermal Overload
The threads that wouldn't die...
- PC reliability?
- Windows, real time
- PID loops
- PCs vs. PLCs
- Replacing people
- MS 'monopoly'?
- Software quality
- Where do we go from here?
- Why pay?
- PC reliability?
- Windows, real time
- PID loops
- PCs vs. PLCs
- Replacing people
- MS 'monopoly'?
- Software quality
- Where do we go from here?
- Why pay?
Fortune
No matter what other nations may say about the United States,
immigration is still the sincerest form of flattery.
immigration is still the sincerest form of flattery.
RSS Feed
www.control.com/rss/
To get a personalized feed, become a member at no cost.
i'm doing a project in VB where i'm using comm port but when i try to open the port it gives the error as port already open though the port is not open.
my source code is as follows:
Private Sub Form_Load()
Dim str As String
MSComm1.CommPort = 1
MSComm1.Settings = "9600,n,8,1"
MSComm1.InputLen = 0
MSComm1.PortOpen = True
Text1.Text = "sending: hello"
MSComm1.Output = "hello"
Do
DoEvents
Loop Until MSComm1.InBufferCount = 0
str = MSComm1.Input
Text1.Text = "recived:" + str
MsgBox "recieved" + str
MSComm1.PortOpen = False
End Sub
Hi..
I tried you code and it worked fine in my computer. You may have that port being used by an other program.
Try using the other serial port.
good luck!!
bye
I tried you code and it worked fine in my computer. You may have that port being used by an other program.
Try using the other serial port.
good luck!!
bye
Another program may have the port already open. Use hyper terminal and see if you can open com port 1. if you can make sure you close it and then make sure your not calling it twice insome other place your not aware of. Like Form Init.
Jim
Jim
What about using the err object in order to retrieve the error code you get?
It may be not opened by your application but can be in use by another software running.
Gregorio Cavazos C.
Gregorio Cavazos C.
perhaps you can do try catch statement to detect whether the port has been opened. just include the open port code in try statement
Hi,
I hope ur problem is solved.I have a doubt to ask.U have sent text 'HELLO' to a port, what's the command i use in hyperterminal to read the string 'HELLO'.
Regards,
Nile
I hope ur problem is solved.I have a doubt to ask.U have sent text 'HELLO' to a port, what's the command i use in hyperterminal to read the string 'HELLO'.
Regards,
Nile
Another common problem when doing these kinds of things in VB is that the comm port may have been opened in a previous attempt to test your code.
If in a previous test run of your code, the port was opened but an error halted execution thereafter, the port will still be open. If this is your problem, closing the VB IDE will close the port...
If in a previous test run of your code, the port was opened but an error halted execution thereafter, the port will still be open. If this is your problem, closing the VB IDE will close the port...
I am having a similar problem. And what is really wierd is that right before the
MSComm1.PortOpen = True
line, I put in a msgbox and ask for the status of the port.
Example:
msgbox("The port is open " & MSComm1.PortOpen)
when that message comes up, it says that the port is False. Then the very next line is
MSComm1.PortOpen = True
and then I get the error saying that the port is already open?!?!?!?!?!
HELP!!!!
MSComm1.PortOpen = True
line, I put in a msgbox and ask for the status of the port.
Example:
msgbox("The port is open " & MSComm1.PortOpen)
when that message comes up, it says that the port is False. Then the very next line is
MSComm1.PortOpen = True
and then I get the error saying that the port is already open?!?!?!?!?!
HELP!!!!
hi friends, i need your help also, i used VB6 for doing development for transfering data from pabx to pc and buffer to pc. my problem is let say i use Windows98, it's working fine. But if i use Windows2000 no error comes out, and my system can't receive any data from outside. means OS already open the port. I check with Microsoft site, they have patch file to disable the auto service. but it still gives same problem...
need your help...
Joe
need your help...
Joe
Anyone solved this problem? I have the same problem. I use the code to open the port. It should gives me error if I have not hook up any cable to the port but it appears to have MSComm1.PortOpen=true anyways.
Please give me some insights.
Thanks!
Please give me some insights.
Thanks!
If you install any one of following software that prob happen.
1> Irda driver
2> bluetooth driver
3> nokia pc suite
check this.
Regards,
Shailesh C Patel
FDC - Control Systems And Instrumentation
Reliance Engineering Associates(P) Ltd.
1> Irda driver
2> bluetooth driver
3> nokia pc suite
check this.
Regards,
Shailesh C Patel
FDC - Control Systems And Instrumentation
Reliance Engineering Associates(P) Ltd.
Thank you Shri Shailesh C Patel , your tip has solved my problem.On my pc there was some irda s/w using COM1 port
Sadly, this may be an MSCOMM issue - I stopped using it back when VB v4 existed because at times it would "drop the ball" and define a port as unavailable when it was unused - or worse - available when it was not. A PC reboot was the only solution. So I started using XCommm from Greenleaf (not sure who owns them now) and it proved very robust.
Also, are you sure a modem dialer isn't using that port? Check out your "network connections" entries. Otehrwise, do a search of the Windows registry for strings COM1 or COM2 and maybe you'll find some tool claiming it.
- LynnL, www.digi.com
Also, are you sure a modem dialer isn't using that port? Check out your "network connections" entries. Otehrwise, do a search of the Windows registry for strings COM1 or COM2 and maybe you'll find some tool claiming it.
- LynnL, www.digi.com
To LynnL, www.digi.com.
Absolutely spot on. Found the COM4 I needed assigned to another device even though it wasn't using it, it was talking to it all the time. I deleted the COM4 references and hardware assignment to the device that was hijacking it and rebooted and woohoo the port remained closed and is accessible to VB again... Thank you.
Absolutely spot on. Found the COM4 I needed assigned to another device even though it wasn't using it, it was talking to it all the time. I deleted the COM4 references and hardware assignment to the device that was hijacking it and rebooted and woohoo the port remained closed and is accessible to VB again... Thank you.
Your use of this site is subject to the terms and conditions set forth under Legal Notices and the Privacy Policy. Please read those terms and conditions carefully. Subject to the rights expressly reserved to others under Legal Notices, the content of this site and the compilation thereof is © 1999-2009 Nerds in Control, LLC. All rights reserved.
Our Advertisers
Help keep our servers running...
Patronize our advertisers!
Patronize our advertisers!




