?
Solved

MsComm

Posted on 2003-03-15
9
Medium Priority
?
190 Views
Last Modified: 2010-05-01
i would like to ask what is the meaning of mscomm.portopen.
why i set mscomm.postopen=Enabled
got error ????
0
Comment
Question by:nana78
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
9 Comments
 
LVL 18

Expert Comment

by:Sethi
ID: 8145650
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
 

Author Comment

by:nana78
ID: 8150089
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
 
LVL 18

Expert Comment

by:Sethi
ID: 8150667
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
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.

 
LVL 18

Accepted Solution

by:
Sethi earned 100 total points
ID: 8150724
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
 

Author Comment

by:nana78
ID: 8156462
CommPort1 is for modem, if i want to use I/O Port, then what is CommPort number ??
0
 
LVL 18

Expert Comment

by:Sethi
ID: 8156733
You will have to check at which port have you installed the Lan Card and then mention that port.
0
 
LVL 18

Expert Comment

by:Sethi
ID: 8180137
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
 

Author Comment

by:nana78
ID: 8188614
give u C grade ??? i only give average.
yes, your comment did help me a lot. Thank you.
0
 
LVL 18

Expert Comment

by:Sethi
ID: 8188736
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month8 days, 10 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question