I have an application like this:
Form 1 => main form. When it loads it must update some information from database and read some files from disk
Form 2=> secondary form
I want to display Form 2 with a progress bar on it while the form1 updates its information and shows up his dialog and then hide form2
I put this code in Form2 class :
BackgroundWorker and ProgressBar demo[
^]
and i put in Form1 LOAD => Form2 f2=new Form2(); f2.Show()
But i don't get any progress in the progress bar...
void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
for (int i = 0; i <= 100; i++)
{
backgroundWorker1.ReportProgress(i);
System.Threading.Thread.Sleep(150);
}
}
private void Form1_Load(object sender, EventArgs e)
{
this.CenterToScreen();
users = usrsrv.ListaUtilizatori();
articles = usrsrv.ListaArticole();
tests = usrsrv.ListaTeste();
userarticles = usrsrv.ListaArticoleUtilizator();
usertests = usrsrv.ListaTesteUtilizator();
fb = usrsrv.ListaFeedback();
existentarticles = usrsrv.IncarcareNumeFisiereExistente();
int i = 0;
foreach (utilizator util in users)
{
ut.Insert(i,util.username);
i++;
}
this.ActiveControl = textBox1;
}