How to read/write data from/to USB Serial by Visual Basic. Dear experts, could u plz tell me how to read/write data from/to USB Serial? Seems that USB adapter on a COM port is OK; but a serial adapter on a USB port will not work with this code. July 05, 2007 05:51 PM.
![]() -->
This topic describes how to use
My.Computer.Ports to receive strings from the computer's serial ports in Visual Basic.
To receive strings from the serial port
Example
This code example is also available as an IntelliSense code snippet. In the code snippet picker, it is located in Connectivity and Networking. For more information, see Code Snippets.
![]() Compiling the Code![]()
This example assumes the computer is using
COM1 .
Robust Programming
This example assumes the computer is using
COM1 . For more flexibility, the code should allow the user to select the desired serial port from a list of available ports. For more information, see How to: Show Available Serial Ports.
This example uses a
Try...Catch...Finally block to make sure that the application closes the port and to catch any timeout exceptions. For more information, see Try...Catch...Finally Statement.
See also![]() Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2023
Categories |