title: Very basic VB.Net & Serial IO issue
body: <p>After searching around I am still having issues with reading data from a serial port in VB.Net/VS2010. I know the Serial Port works, I can write to the port fine but when reading from it, nothing happens. I have only been programming for the last 3 weeks so am still trying to get my head around it all.</p>
  
  <p>The program must run to capture data from a door logger, I will then be outputting the data to a database (not yet implemented - I want to get this part sorted first).
  I have tried using several terminal programs as well as another device which outputs data onto the serial line, with nothing displaying in the textbox <code>tbxIn</code>.</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>Code is below:</p>
  
  <pre><code>Imports System.IO.Ports
  Imports System.IO.Ports.SerialPort
  
  Public Class Form1
  
  Dim comPort As IO.Ports.SerialPort = Nothing
  Dim sComPort As String = ""
  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      GetSerialPortNames()
  End Sub
  
  Sub GetSerialPortNames()
      ' Show all available COM ports.
      For Each sp As String In My.Computer.Ports.SerialPortNames
          lstPorts.Items.Add(sp)
      Next
  End Sub
  
  
  Private Sub lstPorts_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstPorts.SelectedIndexChanged
      sComPort = lstPorts.SelectedItem
      Button1.Enabled = True
  End Sub
  
  Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
      ' Open the serial port using the OpenSerialPort method
      Button1.Enabled = False
      Button2.Enabled = True
  
      Try
          comPort = My.Computer.Ports.OpenSerialPort(sComPort, 9600, IO.Ports.Parity.None, 8, 1)
          ' comPort.DtrEnable = True
          comPort.ReadTimeout = 500
          Do
              comPort.WriteLine("Go")
              Dim sIncomming As String = comPort.ReadLine()
  
              tbxIn.Text = sIncomming &amp; vbCrLf
          Loop
      Catch ex As TimeoutException
          tbxIn.Text &amp;= "Error: Serial Port Read Timeout" &amp; vbCrLf
      End Try
  
  End Sub
  
  Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
      comPort.Close()
      Button1.Enabled = True
      Button2.Enabled = False
  End Sub
  
  Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
      tbxIn.Text = e.ToString
  End Sub
  End Class
  </code></pre>