T tonga Member Licensed User Longtime User Sep 25, 2013 #1 Hi all, I have a tablet that communicates with a microprocessor by means of a serial line. I want to display the strings coming from the microprocessor on a label, but when they arrive the strings are arranged in a disorderly fashion in the label, while I wish the new strings can erase the previous one and the new text always departed from the top spot in the upper left corner of the label. I started using "UsbSerialDemo." Anyone have any suggestions? Thank you in advance
Hi all, I have a tablet that communicates with a microprocessor by means of a serial line. I want to display the strings coming from the microprocessor on a label, but when they arrive the strings are arranged in a disorderly fashion in the label, while I wish the new strings can erase the previous one and the new text always departed from the top spot in the upper left corner of the label. I started using "UsbSerialDemo." Anyone have any suggestions? Thank you in advance
Erel B4X founder Staff member Licensed User Longtime User Sep 26, 2013 #2 Seems like you are creating a new label instead of replacing the existing label text. Upvote 0
T tonga Member Licensed User Longtime User Sep 26, 2013 #3 Erel said: Seems like you are creating a new label instead of replacing the existing label text. Click to expand... Hi Erel, this is the subroutine activated when the tablet receives something: Sub Astreams_NewData (Buffer() As Byte) Dim s As String s=BytesToString(Buffer, 0, Buffer.Length, "UTF8") label1.Text=s End Sub can you tell me where are the errors? Thank you Upvote 0
Erel said: Seems like you are creating a new label instead of replacing the existing label text. Click to expand... Hi Erel, this is the subroutine activated when the tablet receives something: Sub Astreams_NewData (Buffer() As Byte) Dim s As String s=BytesToString(Buffer, 0, Buffer.Length, "UTF8") label1.Text=s End Sub can you tell me where are the errors? Thank you
Erel B4X founder Staff member Licensed User Longtime User Sep 26, 2013 #4 This code is correct. It will replace the content and set the new string. If you are seeing the old text under it then there is a problem somewhere else. Upvote 0
This code is correct. It will replace the content and set the new string. If you are seeing the old text under it then there is a problem somewhere else.
KitCarlson Active Member Licensed User Longtime User Sep 27, 2013 #5 In the non prefix mode, the data may arrive in parts, it is necessary to combine, then set to label when complete. To know when complete, an end marker is often used. Perhaps the AsyncStreams Text, will work better. Erel has a tutorial on that. Upvote 0
In the non prefix mode, the data may arrive in parts, it is necessary to combine, then set to label when complete. To know when complete, an end marker is often used. Perhaps the AsyncStreams Text, will work better. Erel has a tutorial on that.