Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 194
  • Last Modified:

MsComm

i would like to ask what is the meaning of mscomm.portopen.
why i set mscomm.postopen=Enabled
got error ????
0
nana78
Asked:
nana78
  • 6
  • 3
1 Solution
 
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 6
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now