There is a bit of a learning curve so far.
For starters I'm using VB 2008 express edition
I have code that writes a string out of a serial port.
My issue is that the machine sends data back and I don't know how to catch it.
Any help would be greatly appreciated!
This is my latest attempt at creating an array of characters to create a string later but doesn't work.
I've been trying at this for 2 days and figure that has to be a simple solution that I"m not seeing
-Joel
Private Sub tmrReadCommPort_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrReadCommPort.Tick Try ' As long as there is information, read one byte at a time and ' output it. Dim count As Integer = 0 While (m_CommPort.Read(1) <> -1) ' Write the output to the screen. WriteMessage(Chr(m_CommPort.InputStream(0)), False) ArrayChars(count) = Chr(m_CommPort.InputStream(0)) count = count + 1 End While ComReadString1 = New String(ArrayChars) Console.WriteLine(ComReadString1) ComReadString.Text = ComReadString1 Catch exc As Exception ' An exception is raised when there is no information to read. ' Don't do anything here, just let the exception go. End Try End Sub

New Topic/Question
Reply




MultiQuote




|