Question Need ListBox to Show Events in Real-Time

TBossAZ

Active member
Joined
Mar 31, 2009
Messages
43
Programming Experience
5-10
Hello everyone.

I have designed a window application that:
  1. check the contents of a folder for specific files (HTML)
  2. move files to a 'working' diretory
  3. parse each file with webbrowser control to extract data
  4. call webservice to collect additional data

The main form has a large ListBox that displays event messages. What I want is for the application to display the messages as they happen. What seems to be happening is that the application will do everything and then display all of the event messages at once at the very end.

Can anyone give me some pointers on how to write code that will add event messages to the ListBox as they happen?

Any advise would be appreciated.

BTW - using VB.NET 2005 Express.

Thanks.
 
Well the short and easy way to do this would be to put an Application.DoEvents() line in right after updating the message shown to the user (I'm guessing it's a label)

The more elegant way to do this would be to would be to use a background worker to do the work and since you're using controls on the ui thread you'll need to get into delegation to use them but basically the work will be done on a separate thread and you can use the ReportProgress() event to update a status message in the label on the UI thread for the user
 
Back
Top