VB.net Help
-
Friday, May 13, 2005 1:48 AMI am trying to make VB.net communicate with PBasic for a stepper motor controller. I can not find any help on SERIN and SEROUT commands. Could someone please explain how to communicate with another program that runs a Basic Stamp? Thanks for any help.
All Replies
-
Saturday, November 26, 2005 2:21 AMModerator
Sorry for no response in a long time. If you're still looking into this:
The general way to approach serial communication in VB 2005 is to use the SerialPort class. My.Computer.Ports gives you easy access to the particular port you want.
Here is a VB2005 sample to open, read and write to COM1:
Dim buffer As New StringBuilder()
'open the COM1 serial port
Using comPort As SerialPort = My.Computer.Ports.OpenSerialPort("COM1")
'read in data
Do
Dim line As String = comPort.ReadLine()
If line Is Nothing Then
Exit Do
Else
buffer.AppendLine(line)
End If
Loop'write data
comPort.WriteLine("test")
End Using
It is possible to use serial ports in earlier versions of VB.NET such as VB 2002 or 2003. Here is an article on codeworks.it describing that:
http://www.codeworks.it/net/VBNetRs232.htmhope this helps,
Paul Yuknewicz

