strange console output question

D

djc

is this possible:

lets say my output has 2 columns with headings like 'host' and 'status'.

host status
------------
host1 down
host2 up
host3 up
host4 down

when the status of a host changes I want to update the display and have it
appear that only that hosts status changed. I know I can have all output as
a string, update the string and redisplay it, but that will keep repeating
down the screen. To make that better I could simply first clear the screen
before displaying the updated output. But the downside to that is that my
program may then clear other important output from previous console commands
which I don't want to do. What I want to do is give the appearance that the
existing output is updated right in its existing place. So 1) is there a way
to essentially clear *only your* program's output so the whole console
buffer is not lost? or actually just overwrite your existing output? and 2)
as a plan 'B', can I force my program to open in a new console window of its
own?

any input is appreciated. thanks.
 
W

William Stacey [MVP]

If you have 2.0 you have Console.CursorLeft, Console.CursorTop to set cursor
position.

--
William Stacey [MVP]

| is this possible:
|
| lets say my output has 2 columns with headings like 'host' and 'status'.
|
| host status
| ------------
| host1 down
| host2 up
| host3 up
| host4 down
|
| when the status of a host changes I want to update the display and have it
| appear that only that hosts status changed. I know I can have all output
as
| a string, update the string and redisplay it, but that will keep repeating
| down the screen. To make that better I could simply first clear the screen
| before displaying the updated output. But the downside to that is that my
| program may then clear other important output from previous console
commands
| which I don't want to do. What I want to do is give the appearance that
the
| existing output is updated right in its existing place. So 1) is there a
way
| to essentially clear *only your* program's output so the whole console
| buffer is not lost? or actually just overwrite your existing output? and
2)
| as a plan 'B', can I force my program to open in a new console window of
its
| own?
|
| any input is appreciated. thanks.
|
|
 
D

djc

ahh. very cool. I just played around with it a little.

I just need to come up with a way to handle changing a column value from a
long to a shorter value since the old screen info that is not 'overwritten'
is still visible. I assume I just need to have a constant column width and
use padding characters (like spaces) to be sure I overwrite the previous
value completely. Unless you have other suggestions on how to handle that?
 
W

William Stacey [MVP]

That sounds right.

--
William Stacey [MVP]

| ahh. very cool. I just played around with it a little.
|
| I just need to come up with a way to handle changing a column value from a
| long to a shorter value since the old screen info that is not
'overwritten'
| is still visible. I assume I just need to have a constant column width and
| use padding characters (like spaces) to be sure I overwrite the previous
| value completely. Unless you have other suggestions on how to handle that?
 

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