0

can anyone help me...........

i've created a form1 with a progressbar............and i want the form1 to close at the time when the progressbar reaches 100.........and at the same time i want form2 to display............


can anyone help me to do that............

3
Contributors
6
Replies
7
Views
5 Years
Discussion Span
Last Post by Jessurider
Featured Replies
  • 1

    From line 41 of form1.cs :[code]if (progressBar1.Value == 100) { Form1 f = new Form1(); f.Hide(); Form2 f1 = new Form2(); f1.Show(); }[/code] Why are you creating another form1? Did his sample code show him creating another form1? No, so don't do it. [code]if (progressBar1.Value == 100) { this.Hide(); // … Read More

  • 1

    Yep, it's still running. If you closed form1 (form1.Close()) your whole application would stop running. If you want it to stop running after form2 is finished, change the code to: [code]if (progressBar1.Value == 100) { this.Hide(); // You are running code in form1 so 'this' is form1. Form2 f1 = … Read More

1

From line 41 of form1.cs :

if (progressBar1.Value == 100)
{
    Form1 f = new Form1();
    f.Hide();
    Form2 f1 = new Form2();
    f1.Show();
}

Why are you creating another form1? Did his sample code show him creating another form1? No, so don't do it.

if (progressBar1.Value == 100) {
    this.Hide();   // You are running code in form1 so 'this' is form1.
    Form2 f1 = new Form2();
    f1.Show();
}
0

ok in this case

if (progressBar1.Value == 100) {
    this.Hide();   // You are running code in form1 so 'this' is form1.
    Form2 f1 = new Form2();
    f1.Show();
}

when the progressbar1 reaches 100 form1 is hiding and running somewhere........even when we close form2 the whole program is not exiting since form1 is running somewhere..............

Edited by Jessurider: n/a

1

Yep, it's still running. If you closed form1 (form1.Close()) your whole application would stop running. If you want it to stop running after form2 is finished, change the code to:

if (progressBar1.Value == 100) {
    this.Hide();   // You are running code in form1 so 'this' is form1.
    Form2 f1 = new Form2();
    f1.ShowDialog();
    this.Close();
}
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.