Link to home
Start Free TrialLog in
Avatar of jazz__man
jazz__man

asked on

How to implement a visual loop counter as a compliment to the already implemented progress bar. VB.NET Windows Form.

Hi

On my vb.net windows form I have a progress bar which increments based on a for each loop. Since this works very well, I was hoping to extend the idea to display a realtime numeric representation of what the progress bar is doing. Basically a numeric counter, we've all seen these kind of counters when extracting files, installing programs etc. Well its one of those I am looking for.

I have tried doing this by trying to update the text property of a label after every loop but for some reason this does not work until the last loop. I think this is to do with threading, but please advise.

I would be very grateful for any help on this problem.
ASKER CERTIFIED SOLUTION
Avatar of Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs)
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jazz__man
jazz__man

ASKER

All I needed was these two lines..
Threading.Thread.Sleep(50)
Application.DoEvents()

Superb!! Have a nice day.

Cheers

Paul
Paul,

Note that I only put "Threading.Thread.Sleep(50)" in there to slow down the execution of the loop. It will work just as well without it.

Wayne
Ok, cheers Wayne.