471,605 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,605 software developers and data experts.

Very Fast Updates to GUI - blank out

I have an application that does alot of work and calculations. It
updates it's internal status on a windows form. When I debug single
step the numbers appear just right on the form. When I run the program
in normal mode the text boxes to which the info is displayed just blank
out. Sometimes the entire form just turns all white. I get the
impression that the updates are happening too fast or something like
that.

What's going on? Any ideas?

Jan 17 '06 #1
5 3219

"carqs123" <ca******@hotmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I have an application that does alot of work and calculations. It
updates it's internal status on a windows form. When I debug single
step the numbers appear just right on the form. When I run the program
in normal mode the text boxes to which the info is displayed just blank
out. Sometimes the entire form just turns all white. I get the
impression that the updates are happening too fast or something like
that.

What's going on? Any ideas?


The update processing is taking time so the paint event is not able to paint
the form until it's finished perhaps.
Does the form eventually get painted with the correct data if you leave it
long enough?

Chris
Jan 17 '06 #2
carqs123 <ca******@hotmail.com> wrote:
I have an application that does alot of work and calculations. It
updates it's internal status on a windows form. When I debug single
step the numbers appear just right on the form. When I run the program
in normal mode the text boxes to which the info is displayed just blank
out. Sometimes the entire form just turns all white. I get the
impression that the updates are happening too fast or something like
that.

What's going on? Any ideas?


What is your threading model? Are you doing most of your work in the UI
thread? If so, that's the problem. See
http://www.pobox.com/~skeet/csharp/t...winforms.shtml

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jan 17 '06 #3
Me
Yea. it sounds like you are telling it to paint itself to death!
Paint()
Paint()
........
Paint()

There is no time given to actually update the display (screen) because it is
stuck inside a very tight loop. Sort of like

while(true)
{
Paint();
}

Might want to look over your program flow and see if you can break it up
some. Maybe use a timer or something like that to update the display? Do you
really need to see an update on the screen every 10ms? Would every 100ms
work just as good?

"carqs123" <ca******@hotmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I have an application that does alot of work and calculations. It
updates it's internal status on a windows form. When I debug single
step the numbers appear just right on the form. When I run the program
in normal mode the text boxes to which the info is displayed just blank
out. Sometimes the entire form just turns all white. I get the
impression that the updates are happening too fast or something like
that.

What's going on? Any ideas?

Jan 17 '06 #4
Update to this thread. I finally found the solution by reading the
O'Reilly book on Windows Forms.

I was missing an Application.DoEvents() statement.

Jan 25 '06 #5
carqs123 <ca******@hotmail.com> wrote:
Update to this thread. I finally found the solution by reading the
O'Reilly book on Windows Forms.

I was missing an Application.DoEvents() statement.


Calls to do events should very, very rarely be useful if you're already
threading properly - e.g. not doing your main work in the UI thread.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jan 25 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Tan Thuan Seah | last post: by
2 posts views Thread by Molly | last post: by
10 posts views Thread by Jason Curl | last post: by
50 posts views Thread by diffuser78 | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by MichaelMortimer | last post: by
reply views Thread by CCCYYYY | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.