Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Visual Basic
 Port Operations in the .NET Framewo...
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Visual Basic Application Development
Port Operations in the .NET Framework with Visual Basic

You can access your computer's serial ports through the .NET Framework classes in the System.IO.Ports namespace. The most important class, SerialPort, provides a framework for synchronous and event-driven I/O, access to pin and break states, and access to serial driver properties. It can be wrapped in a Stream object, accessible through the BaseStream property. Wrapping SerialPort in a Stream object allows the serial port to be accessed by classes that use streams. The namespace includes enumerations that simplify the control of serial ports.

The simplest way to create a SerialPort object is through the My.Computer.Ports.OpenSerialPort method.

NoteNote:

You cannot use .NET Framework classes to directly access other types of ports, such as parallel ports, USB ports, and so on. To access your computer's network, see Classes Used in .NET Framework Network Operations.

This table lists and describes the main enumerations used for accessing a serial port:

Enumeration

Description

Handshake

Specifies the control protocol used in establishing a serial port communication for a SerialPort object.

Parity

Specifies the parity bit for a SerialPort object.

SerialData

Specifies the type of character that was received on the serial port of the SerialPort object.

SerialError

Specifies errors that occur on the SerialPort object

SerialPinChange

Specifies the type of change that occurred on the SerialPort object.

StopBits

Specifies the number of stop bits used on the SerialPort object.

This table lists and describes the main tasks for accessing a serial port:

To

See

Show available serial ports

How to: Show Available Serial Ports in Visual Basic

Dial a modem attached to the serial port of a computer

How to: Dial Modems Attached to Serial Ports in Visual Basic

Send a string to a computer's serial port

How to: Send Strings to Serial Ports in Visual Basic

Receive a string from a computer's serial port

How to: Receive Strings From Serial Ports in Visual Basic

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker