Hi Guys,
I'm trying to save data that i received from serial port into text file. So far, there is nothing in the file. What should i do?
Here is the code:
Code:Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick If SerialPort1.IsOpen Then Data_received &= SerialPort1.ReadExisting If Len(Data_received) > 0 Then ReceiveTextBox.Text = Data_received HistoryTextBox.Text = TimeOfDay.ToLongTimeString + " : " + Data_received + vbNewLine + HistoryTextBox.Text Dim writeFile As New System.IO.StreamWriter("Read.txt") writeFile.Write(SerialPort1.ReadExisting()) writeFile.Close() End If End If End Sub




Reply With Quote
