Windows Develop Bookmark and Share   
 index > Windows Forms Sample Applications > com port
 

com port

How to set up the com1 port for say 9600,8,n,1 in vc2005/vb2005 and output a byte to the port?

K.Sridharan  Monday, April 10, 2006 3:31 AM

K. Sriharan,

This is the sample Comport setting.

// Set the port's settings

comport.BaudRate = 38400;

comport.DataBits = 7;

comport.StopBits = (StopBits)Enum.Parse(typeof(StopBits), "Two");

comport.Parity = (Parity)Enum.Parse(typeof(Parity), "Even");

comport.PortName = "COM1";

// Open the port

To Send a byte.

Use this method:

comport.write()

Have a try ..

bibi

tlbong  Monday, April 10, 2006 8:55 AM

K. Sriharan,

This is the sample Comport setting.

// Set the port's settings

comport.BaudRate = 38400;

comport.DataBits = 7;

comport.StopBits = (StopBits)Enum.Parse(typeof(StopBits), "Two");

comport.Parity = (Parity)Enum.Parse(typeof(Parity), "Even");

comport.PortName = "COM1";

// Open the port

To Send a byte.

Use this method:

comport.write()

Have a try ..

bibi

tlbong  Monday, April 10, 2006 8:55 AM
Or like this, with the values you requested:

comport.BaudRate = 9600;

comport.DataBits = 8;

comport.StopBits = StopBits.One;

comport.Parity = Parity.None;

comport.PortName = "COM1";

awe  Friday, May 05, 2006 12:00 PM

try this link. I posted this several months ago, then found the answer and posted it in the thread.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=160755&SiteID=1

Tony

TonyK_  Saturday, May 06, 2006 8:27 PM
Has any body else had problems opening a port using

comport.StopBits = StopBits.None;

mine comes up with index out of range?

Shaunc33  Monday, March 16, 2009 11:34 AM

You can use google to search for other answers

Custom Search

More Threads

• Server
• InstallShield
• Deploying Windows Applications with Crystal Reports IN VS2005
• IssueVision for VS2005.
• Terrarium Servers Back Up!
• VS.net 2002 installation errors off issueVision
• Provider Pattern is here
• Seeking a simple program ~ text to binary converter
• draw a waveform
• Newbie I'm sure it's an obvious answer