?
Solved

VB.net app screen does not refresh

Posted on 2006-04-26
5
Medium Priority
?
2,333 Views
Last Modified: 2009-07-29
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?
0
Comment
Question by:beaconlightboy
  • 3
  • 2
5 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 16544759
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
 
LVL 3

Author Comment

by:beaconlightboy
ID: 16544776
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
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 16544798
So you need a simple example of how to set up a thread and update the main GUI from it?
0
 
LVL 3

Author Comment

by:beaconlightboy
ID: 16544803
that would be great.  
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 16544831
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Introduction to Processes

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question