Visual Basic (VB) is a well-known event-driven programming language that is a major component of Microsoft's .NET programming environment. Visual Basic is backwards compatible with the COM programming model and is best known for incorporating predefined user interface components that permit programmers to create graphical user interfaces (GUI's) for programs in a significantly reduced amount of time. You can also configure USB port information using Visual Basic's access to the COM programming model.
- Skill level:
Other People Are Reading
Open a your Visual Basic project in your Integrated Development Environment. Once your project is loaded, open the programming window for the section of you program you desire to configure the USB device communications port.
Create a new class member that extends the System.IO.Ports.SerialPort with the following code statement: Friend SelectedPort As System.IO.Ports.SerialPort
Create a handle to the computer's serial port. A handle will allow you to access the data associated with the port and change the configuration information. Enter the following code to create the serial port handle: selected Port = My.Computer.Ports.OpenSerialPort( "COM4", 9600, Parity.None, 8, StopBits.One)
Confirm the connection to the USB serial port is operational. To do this, enter the following code: selectedPort.Handshake = Handshake.RequestToSend
Change the read and write timeout configuration variables of the USB serial port. The settings are made in milliseconds, so a value of 1000 is approximately one second. The code to configure the read and write timeout settings is: selectedPort.ReadTimeout = 1000 selectedPort.WriteTimeout = 1000
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for