Click here to Skip to main content
15,902,114 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have used the COM ports in the past to communicate with outside processors STM32. I am glad to see COM ports are still in VS2010. I just cannot remember what Reference to use?
Posted

1 solution

Hi,

You need only reference to System in your project.

Then in using clause add System.IO.Ports.

Class name is SerialPort and you don't have to put it on your form. You can instantiate it from your code:

C#
var sp = new SerialPort();
sp.BaudRate = 9600;
sp.PortName = "COM1";
..


[Update]
I just arrived home from work and run Visual Stusio 2013 Express. There is a tab 'Components' visible by default and there is SerialPort item on it.
If you don't have this item simply just click Right Mouse Button on that tab and select option Choose Items. Then go to the .NET Framework Coponents tab and start typing Serial Port on Filter textbox. Then just click on item SerialPort on the list above to highlight that item and then Click 'OK' button.
Another option is to select Reset toolbox option to get back to defaults.

Cheers!
 
Share this answer
 
v3
Comments
Sergey Alexandrovich Kryukov 1-Dec-14 11:24am    
5ed.
—SA
Marcin Kozub 1-Dec-14 11:25am    
Thx Sergey!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900