Click here to Skip to main content
15,798,037 members
Please Sign up or sign in to vote.
4.58/5 (6 votes)
See more:
Good people,

I have a quick question. For the screens in my application, before they load, I need to fetch data from the database, perform some calculations, then load it onto the screen. However, rather than the software just freeze up during this process, I would like the progress bar to indicate the, well, progress towards the screen being loaded.

My question is: how do I make the progress bar show the progress during that process of getting data from the database and updating the screen?


You should check out the BackgroundWorker Component.
Share this answer

I created my ProgressWorker article for exactly this purpose.

Share this answer
You just design a form containing progressbar control and make the modifier property of progressbar control as public. create intance of the progressbar control form in the main form. set the maximum,minimum and value property values after creating instance. increment the value property during the process and add the following code below for every increment

if you run the appliction you will see the progressbar without freezing

hope this helps

Share this answer
you can use Doevents() in your codes.
Share this answer
Lets create a form and drop a progressbar from toolbox
create another form which is the main form of your application.

in the "main form" create a thread in form_load event and assign below code like,
Thread t=new Thread("FisrtForm");

void FirstForm()
FirstForm f=new FirstForm();;

and int the form loaded event of Mainform create a n object for it and by using show() method display that one again.

'm not sure about it but it may solve/helpful for your problem.

Thank You.
Share this answer

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900