VB.NET Screen Stops Refreshing After Losing Focus??

C

Chris Moore

I have a .NET form where I am updating a progress bar & counter. As long
as the form never loses focus, everything on the form refreshs fine. But If
I open another window (like Windows Explorer) and then re-select my .net
form, thos fields no longer refresh. Why and ho wdo I make it start
refreshing again?

Thanks
 
M

Mehdi

I have a .NET form where I am updating a progress bar & counter. As long
as the form never loses focus, everything on the form refreshs fine. But If
I open another window (like Windows Explorer) and then re-select my .net
form, thos fields no longer refresh. Why and ho wdo I make it start
refreshing again?

It sounds like you're accessing some of your UI controls from a worker
thread (the progress bar and the counter probably). UI controls must be
accessed from the UI thread only. If you have to access them from a worker
thread, use Control.Invoke or Control.BeginInvoke to marshall the call to
the UI thread.
 
C

Chris Moore

I have no idea what you just said, sorry. What I have is 1 form with a
button, progress bar & label on it. When I run it, I press the button
that then calls a procedure (that is in the form) to process some records
and update the controls.

What am I missing or not understanding?

Thanks
 
T

tommaso.gastaldi

try putting

Application.DoEvents()

within the loop

-tom

Chris Moore ha scritto:
 
T

tommaso.gastaldi

good.
Applications are like humans, sometimes they need to breath :)

-tom

ods ha scritto:
 
O

OC

Good grief! I've Googled high and low for this answer. I

've been developing Web apps for so long I'd forgotten how to do this.
I know this is not the way I used to do it but this is far easier.
Thank you so much!

-Olice
 

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