Hello everyone,
I generally look at Google and other websites before I post a question, but trust me I still cannot find and answer to this problem.
I'm using VB.net. My problem being is that I don't know how to redirect the serial port output to a selected file. I looked in the forum but no luck.
Here is the sequence of events.
User selects a file to write to. No problem here.
Sends a command to the equipment to start outputting text. No problem here.
At the moment the text is going to text box. Is easy to wait for the output to finish and then save the file. But I do not want this. The user does not need to see the text. Just some sort of indication that data is being sent. No Problem here.
Is more like a Serial Port Data Log.
Friend Sub DataReceived(By Val sender As Object, ByVal e As SerialDataRecei vedEventArgs)
Dim newReceivedData As String
Try
' Get data from the COM port.
newReceivedData = selectedPort.Re adExisting
' Save the number of characters received.
receivedDataLen gth += newReceivedData .Length
RaiseEvent UserInterfaceDa ta("AppendToMon itorTextBox", newReceivedData , Color.Black)
' I guess I could choose to Write the line to the file instead.
Catch ex As Exception
DisplayExceptio n(ModuleName, ex)
End Try
End Sub
Any suggestions? Thanks!
I generally look at Google and other websites before I post a question, but trust me I still cannot find and answer to this problem.
I'm using VB.net. My problem being is that I don't know how to redirect the serial port output to a selected file. I looked in the forum but no luck.
Here is the sequence of events.
User selects a file to write to. No problem here.
Sends a command to the equipment to start outputting text. No problem here.
At the moment the text is going to text box. Is easy to wait for the output to finish and then save the file. But I do not want this. The user does not need to see the text. Just some sort of indication that data is being sent. No Problem here.
Is more like a Serial Port Data Log.
Friend Sub DataReceived(By Val sender As Object, ByVal e As SerialDataRecei vedEventArgs)
Dim newReceivedData As String
Try
' Get data from the COM port.
newReceivedData = selectedPort.Re adExisting
' Save the number of characters received.
receivedDataLen gth += newReceivedData .Length
RaiseEvent UserInterfaceDa ta("AppendToMon itorTextBox", newReceivedData , Color.Black)
' I guess I could choose to Write the line to the file instead.
Catch ex As Exception
DisplayExceptio n(ModuleName, ex)
End Try
End Sub
Any suggestions? Thanks!
Comment