MsComm

i would like to ask what is the meaning of mscomm.portopen.
why i set mscomm.postopen=Enabled
got error ????
nana78Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SethiCommented:
PortOpen Property
This property is not available at design time.
It sets or returns the state of the communications port. i.e. if we want to know whether a communication port is open or closed then we can use this property, or if we want to open or close a communication port through our code, then we can use this property.

It takes only following two values:
True     Port is opened
False     Port is closed

Setting the PortOpen property to True opens the port. Setting it to False closes the port and clears, the receive and transmit buffers. The MSComm control automatically closes the serial port when your application is terminated.

Make sure the CommPort property is set to a valid port number before opening the port. If the CommPort property is set to an invalid port number when you try to open the port, the MSComm control generates Error 68 (Device unavailable). In addition, your serial port device must support the current values in the Settings property. If the Settings property contains communications settings that your hardware does not support, your hardware may not work correctly.
0
nana78Author Commented:
how to know that correct CommPort property??
when i set PortOpen=True,CommPort=1, it return that port is already open,but if i set CommPort=2, then no error, why ????
0
SethiCommented:
CommPort 1 is generally the one where you Modem is attached. If any application is using this port and locks other application to use this port you will get this error. You need not specify 2 in such cases becuase that would not help. Give me a few minutes and I will look into the problem.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

SethiCommented:
You simply have to close the port before opening it. Use the following code:
If objComm.PortOpen = vbTrue Then
    objComm.PortOpen = False
End If

objComm.PortOpen = True

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
nana78Author Commented:
CommPort1 is for modem, if i want to use I/O Port, then what is CommPort number ??
0
SethiCommented:
You will have to check at which port have you installed the Lan Card and then mention that port.
0
SethiCommented:
Didn't my answer solve your problem properly? Or is there something that I am missing? If not then why have you given me C grade for the answer?
0
nana78Author Commented:
give u C grade ??? i only give average.
yes, your comment did help me a lot. Thank you.
0
SethiCommented:
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.