Hi there,
I need some help with serial port data readings from a scale connected to my pc.
I found a very simple way to read data from the serial port and show the results each time the serial port receives data:
First, I open the serial port with a click on a button:
Then, each time the scale sends data, I can display it it in the console window:Code:Private Sub Button1_Click_2(sender As Object, e As EventArgs) Handles Button1.Click SerialPort1.Open() End Sub
Code:Private Sub SerialPort1_DataReceived(sender As Object, e As IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived Console.WriteLine(SerialPort1.ReadLine()) End Sub
I would like to simply display the data in a textbox, but get errors
Has anyone a SIMPLE solution for this?Code:Private Sub SerialPort1_DataReceived(sender As Object, e As IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived Dim returnStr As String = "" returnStr = SerialPort1.ReadLine() TextBoxWaage_Read.Text = returnStr Console.WriteLine(returnStr) End Sub
Thank you,
Thomas




Reply With Quote
