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?
TeDeSmConnect With a Mentor Author 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.
Did you try Thread.Sleep()?

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

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.