VB.net app screen does not refresh

i wrote and application which that reads thru my server event logs.  the log files can be large and i have a progress bar on a statusbar.

the text in the status bar will update itself when told to, for instance ["now reading record ## of ##"]  but the statusbar will not increment.  even when i force a refresh of it.  also, when i minimize the app, and then bring it backup, the statusbar text refuses to even update anymore.

how do i fix this?
LVL 3
beaconlightboyAsked:
Who is Participating?
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Sounds like you have a "tight loop" that is processing your logs.  Because of this your app is unable to process its messages and updates its interface since it is stuck in the loop.

The simple solution is to add this line:

    Application.DoEvents()

inside your loop to allow your app to process its messages and update accordingly.

The "correct" solution though would be to move your processing into another thread so that your main UI interface does not get locked up.   This is more complex though is you need to use Delegates to marshal the call from your thread back onto the main UI thread.  Let me know if you want to go that route...
0
 
beaconlightboyAuthor Commented:
i was researching threads, but wasnt sure how to update the gui when using one.  when i set on up it just ran the code and said it was done, even though i know it wasnt.
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
So you need a simple example of how to set up a thread and update the main GUI from it?
0
 
beaconlightboyAuthor Commented:
that would be great.  
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.