Alright, I'm pulling hair out of my head trying to figure this out.
I have Data coming in through a serial port and it consists of pretty much
all numerical values except for a few begining response characters. Its
a Load Cell which spits out Tension in Pounds. I'm making a simple terminal
program with the ability to log the Incoming Data for record keeping and data
plotting. I want the incoming Tension to be displayed on the screen real time.
I can get it into a text box and have it scroll indefinetly as it updates the data,
but I'd like to keep it localized in one Label. I can display it in the Label but
it wants to scroll down as it comes in. I want to keep it refreshed in one spot if that makes any sense. Heres what I have thus far. It will put it in the Label but wants to scroll like in the textbox.

For example if I send #00F0 followed by a carriage return it replys back with whatever is displayed on the Screen
which usually is the tension.

it says "01TK 00.074 LBS" no quotes.. for a reply.

I'm assuming it needs to be stripped down to just the numeric characters first.

'here is what gets sent to the Load Cell to tell it to output data fast as it can to the serial port.
Private Sub btnTransmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTransmit.Click
SerialPort1.Write("#00WI1" & vbCr)
End Sub

'Here is the Serialport incoming
Private Sub SerialPort1_DataReceived(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
Dim msg As String
msg = SerialPort1.ReadExisting
lblDisplay.Text = "" & lblDisplay.Text & msg
End Sub

Any input on how I can go about doing this would be greatly appreciated.


Edited by DartDemon: n/a

Attachments Terminal.jpg 18.83 KB Terminal2.jpg 19.16 KB
6 Years
Discussion Span
Last Post by dghervas

It will put it in the Label but wants to scroll like in the textbox.

Maybe I didn't quite get that, but instead of appending new messages to the label you should replace previous text with the new message text(?):

lblDisplay.Text = msg

Or if you did mean that the whole message isn't shown, use a smaller font size in the label (second image showed you're using quite a big font size).



I dodnt quite understand.
You want that big multiline textbox the one in the left-down corner to be a label instead of a textbox?
And you want it to update as you get more data line by line but not let it autoscroll to the last entry?


oh or you want it to be a label and have the last entry first on the list and old ones go down hen new entry comes??
in that case you do something like this:

label.text = msg & vbnewline & label.text


Well, the Load Cell is hooked up to a indicator which displays the tension real time on it, like looking at a digital altimeter or something of that affect. I just want that same affect displayed in the Label. The unit is located 180 some odd ft away so thats the reason I need it displayed via onscreen computer in a decent font size so a room full of people can easily view it. I'd like to view it like this in the screen shot ive enclosed. It has to display like it does on the remote indicator, ie; digital speedometer.

Attachments Terminal3.jpg 22.18 KB

I hope i understood what you want it to do :)
But i dont see the problem
this updates the textbox right?
lblDisplay.Text = "" & lblDisplay.Text & msg

why do you do that? just update the textbox
lblDisplay.Text = msg

this way it wont give the scrolling efect
If this way you were trying to kee a record of the values just store them in something separate...

I hope that helpes

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.