Here is a quick simple program to get you started with reading and writing data from the serial port using Visual Basic .Net 2005.
Imports System
Imports System.IO.Ports
Imports System.Threading
Public Class Module1
Shared ser As SerialPort
Shared cont As Boolean
Public Shared Sub Main()
Dim message As String
ser = New SerialPort()
Dim readThread As Thread = New Thread(AddressOf Read)
ser.PortName = "COM1"
ser.BaudRate = 2400
ser.Parity = Parity.None
ser.StopBits = StopBits.One
ser.Handshake = Handshake.None
ser.ReadTimeout = 500
ser.WriteTimeout = 500
ser.Open()
cont = True
readThread.Start()
While (cont)
message = Console.ReadLine()
If message = "p" Then
cont = False
End If
ser.WriteLine(message)
End While
readThread.Join()
ser.Close()
End Sub
Public Shared Sub Read()
While (cont)
Try
Dim charAsInt As Integer
charAsInt = ser.ReadChar()
Dim message As Char = Chr(charAsInt)
Console.WriteLine(message)
Catch ex As Exception
'Do nothing
End Try
End While
End Sub
End Class
As you can see it allows you to type whole strings to a console and send them. Data is received 1 character at a time.