Hi,..
Respected Sir,
I am a programming student.I want some help on c# windows application related to this.Close(),this.Dispose() on the following...
//In windows application, on Form1-- Button1_Click(-----) i write code
Private void Button1_Click(---,-----)
{
this.Close();
this.Dispose();
Form2 frm=new Form2();
frm.ShowDialog();
}
// to show Form2,but it does not works.. ! I want to close and dispose Form1 while at the same time want to show Form2 .
when i click the button on form1, the whole application get closed.
So please help me to solve this..
Waiting For your reply..
Thanks
--
Gururaj
Loading
Mahesh ChandPosted Feb 4, 2009, 12:02 PM
You are closing and disposing Form1 before opening Form2.
Remove this from button click:
this.Close();
this.Dispose();
and call this on Form2 constructor by using an instance of Form1.
LisaPosted Feb 17, 2009, 5:51 AM
you either need to call it in ur program.cs of the windows application or by creating an instance of form2 while closing form1 to run the form2 when the first form is closed.
Thanks,
Lisa
LisaPosted Feb 17, 2009, 5:51 AM
you either need to call it in ur program.cs of the windows application or by creating an instance of form2 while closing form1 to run the form2 when the first form is closed.
Thanks,
Lisa