Best way to display real-time data in place?

P

phileo

I have an application where I wish to display and update some text in
place, eg:

Status1 = val123
Status2 = val345
Status3 = val456


The valXXX is real-time data which needs to be periodically updated
and re-displayed at the same location in the console (effectively
overwriting the old valXXX numbers).

Is a TextBox the best way to do this, or is there a better approach?
 
D

Devin

[...]
The valXXX is real-time data which needs to be periodically updated
and re-displayed at the same location in the console (effectively
overwriting the old valXXX numbers).
Is a TextBox the best way to do this, or is there a better approach?

Impossible to say whether TextBox is the "best way", without more  
specifics.

Basically, if you have a Forms application in which you want to display  
some information, and that information can be formatted as text, and doing 
so it the most natural way to present that information to the user, then  
sure...one of the text-based Forms controls would be appropriate.

For straight-forward display, I prefer the Label control.  But if you want  
the user to be able to select the text (for example, so that they can copy 
and paste it elsewhere), a TextBox would be required.  You can make the  
TextBox read-only so that the user can only select the text, without  
changing it.  If you have a need to include formatting in the display,  
then you'll need to use RichTextBox.

Of course, you can always implement your own custom control to display the 
data in whatever way you like.  So if you have needs beyond what these  
controls provide, that's always an option.

Pete

As another suggestion, if the real-time data is derived from some kind
of continous running process, you might want to update asynchronously
by means of a separate thread or maybe a BackgroundWorker. This will
allow continuous user interface with the form and prevent undesired
effects such as the form not re-painting itself.

Devin
 
D

Devin

[...]
The valXXX is real-time data which needs to be periodically updated
and re-displayed at the same location in the console (effectively
overwriting the old valXXX numbers).
Is a TextBox the best way to do this, or is there a better approach?

Impossible to say whether TextBox is the "best way", without more  
specifics.

Basically, if you have a Forms application in which you want to display  
some information, and that information can be formatted as text, and doing 
so it the most natural way to present that information to the user, then  
sure...one of the text-based Forms controls would be appropriate.

For straight-forward display, I prefer the Label control.  But if you want  
the user to be able to select the text (for example, so that they can copy 
and paste it elsewhere), a TextBox would be required.  You can make the  
TextBox read-only so that the user can only select the text, without  
changing it.  If you have a need to include formatting in the display,  
then you'll need to use RichTextBox.

Of course, you can always implement your own custom control to display the 
data in whatever way you like.  So if you have needs beyond what these  
controls provide, that's always an option.

Pete

As another suggestion, if the real-time data is derived from some kind
of continous running process, you might want to update asynchronously
by means of a separate thread or maybe a BackgroundWorker. This will
allow continuous user interface with the form and prevent undesired
effects such as the form not re-painting itself.

Devin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top