C
cmdolcet69
Im trying to raed data over a com port. The data comes over the serial
port as such reading CRLF reading CRLF and so on.
The code below only sees the first reading CRLF and then only added
that into the DSIDXPort arraylist and never adds readings 2 through
16.....
How can I get it to read those?
port as such reading CRLF reading CRLF and so on.
The code below only sees the first reading CRLF and then only added
that into the DSIDXPort arraylist and never adds readings 2 through
16.....
How can I get it to read those?
Code:
serialPort.ReadTimeout = 50
serialPort.DiscardInBuffer()
Dim strData As String = String.Empty
If Not serialPort.IsOpen Then
strData = String.Empty
Else
strData = serialPort.ReadLine
End If
If strData.Length > 0 Then
Dim tempArray() As String
strData = strData.Replace(vbCrLf,
vbTab).Replace(Chr(26), "").Replace(Chr(12), "").Replace(Chr(13), "")
'parses out the information gathered from the COM port
to a temp location
tempArray = Split(strData, vbTab)
If serialPort.ReadTimeout = 50 Then
Dim intLoop As Integer
For intLoop = 0 To UBound(tempArray)
If IsNumeric(tempArray(intLoop)) Then
DSIMRPort.Add(tempArray(intLoop))
End If
Next
End If
end if
[\CODE]