A
Ashish
It might be basics for many but I never gave attention on this before.
Steps:
Add 2 forms (Form1/Form2) in application.
Create a object in Form1 for Form2.
Form2 f2 = new Form2(); //line 1
//f2.Show(); // line 2
f2.Close(); // line 3
f2.Show(); // works just fine // line 4
Give attn on line 2 as it is marked out. In line 4 it shows form. But when I
uncomment line 2 it gives error on line 4. I hope to get this behavior even
when line 2 is commented out.
1- why dispose is not called when I call Close when line 2 is commented?
2- what is happening in Close() when line 2 is commented?
3- why it is working when I create form object, call close on it, and then
show it?
4- what is happening when I do Show(), Close(), and then Show() ?
In my understanding object is in hidden state after creation. Show only
makes Visible property of form to true. Now I am sure there is something
more to it than just making the form visible.
Thanks a lot,
Ashish
Steps:
Add 2 forms (Form1/Form2) in application.
Create a object in Form1 for Form2.
Form2 f2 = new Form2(); //line 1
//f2.Show(); // line 2
f2.Close(); // line 3
f2.Show(); // works just fine // line 4
Give attn on line 2 as it is marked out. In line 4 it shows form. But when I
uncomment line 2 it gives error on line 4. I hope to get this behavior even
when line 2 is commented out.
1- why dispose is not called when I call Close when line 2 is commented?
2- what is happening in Close() when line 2 is commented?
3- why it is working when I create form object, call close on it, and then
show it?
4- what is happening when I do Show(), Close(), and then Show() ?
In my understanding object is in hidden state after creation. Show only
makes Visible property of form to true. Now I am sure there is something
more to it than just making the form visible.
Thanks a lot,
Ashish