how to code a user defined loop to run a progress bar as a separate thread

  • Thread starter Thread starter Viet
  • Start date Start date
V

Viet

I am trying to code a program that inputs a number (the max value) for a
progress bar which will execute as a separate thread. I know how to create a
progress bar as a separate thread but I am having difficulty trying to
create the user defined loop for the progress bar. Any help is appreciated!
Thanks
Jonathan
 
So you want the user to enter the max value of the progress bar, and then let
the progress bar run from 0 to the max value? What type of operation will it
be, or is it just for testing.

Create a simple for / next loop for testing. Define the operation as a Sub,
and execute the sub by using a thread.

Sub RunProgress()

dim myCounter as long
progressBar.Max = clng(txtMaxValue.text)

for myCounter = 0 to clng(txtMaxValue.text)
progressBar.value = myCounter
next

End Sub

Call it like this

.....
dim th as new thread(AddressOff RunProcess)
th.start
....
 
Viet said:
I am trying to code a program that inputs a number (the max value) for a
progress bar which will execute as a separate thread. I know how to create
a
progress bar as a separate thread but I am having difficulty trying to
create the user defined loop for the progress bar.

Multithreading in Windows Forms applications
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=multithreading&lang=en>

(Although the sample is written in C#, take a look at the last link on the
page referenced above.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top