How to use WPF Progress Bar by providing the increments from a counter, VB.Net

I have a simple WPF form that produces documents for faxing. I have to give a delay between each document that is sent to the Fax Server, I also know the number of documents to be faxed.

I would like to show progress for the total number of documents as each one is sent and also indicate the time delay between each document using Progress Bars. The delay would be 10 seconds.

I'm currently using the sub listed below for the delay, it does not have to be accurate and it is only required to give time for the document to be passed to the Fax server.

Private Sub WaitSeconds(ByVal intSeconds As Integer)
Dim sw As New System.Diagnostics.Stopwatch
	Do Until sw.Elapsed.Seconds >= intSeconds
	sw = Nothing

End Sub

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Did you try Thread.Sleep()?

For example, instead of a call to the above method, add this

TeDeSmAuthor Commented:
Thanks guys, but it looks like I have a bit more reading to do before getting into those examples.

All the problems appear to be to do with Threading as the Progressbar needs its own thread to run in otherwise you have problems if it runs in the same thread as your app.

I had looked at Thread.Sleep for the delay but needed something to generate a 'tick' for a Progressbar.

Shelving this one for the time being until my learning curve has climbed a bit.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.