johnadonaldson
Well-known member
- Joined
- Nov 9, 2005
- Messages
- 48
- Programming Experience
- 10+
I have declared a string at the top of a program. In a subroutine I bring in
the RS232 chars and put then into the string.
After I have done what I want with the data, I need to reset the string
so that then next RS232 access does not get added to the end of the
string.
So how do I reset the string pointer to start a the beginning of the string?
Public Share sBuf2 as String
Dim sBuf as String
Private Sub tmrRead_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrRead.Tick
Try
' As long as there is information, read one byte at a time and
' output it.
While (oCP.Read(1) <> -1)
'Write data to terminal screen
fOpTerm.DisplayMessage(Chr(oCP.InputStream(0)), False)
sBuf += Chr(oCP.InputStream(0))
End While
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
sBuf2 = sBuf
End sub
the RS232 chars and put then into the string.
After I have done what I want with the data, I need to reset the string
so that then next RS232 access does not get added to the end of the
string.
So how do I reset the string pointer to start a the beginning of the string?
Public Share sBuf2 as String
Dim sBuf as String
Private Sub tmrRead_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrRead.Tick
Try
' As long as there is information, read one byte at a time and
' output it.
While (oCP.Read(1) <> -1)
'Write data to terminal screen
fOpTerm.DisplayMessage(Chr(oCP.InputStream(0)), False)
sBuf += Chr(oCP.InputStream(0))
End While
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
sBuf2 = sBuf
End sub