Click here to Skip to main content
15,888,816 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?

Thanks,
Blitz
Posted

You should check out the BackgroundWorker Component.
 
Share this answer
 

I created my ProgressWorker article for exactly this purpose.

 
Share this answer
 
Hi
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
System.Windows.Forms.Application.DoEvents();

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

hope this helps

kumaran
 
Share this answer
 
Hi.
you can use Doevents() in your codes.
 
Share this answer
 
Hi,
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");
t.start();

void FirstForm()
{
this.hide();
FirstForm f=new FirstForm();
f.show();
}

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