Hi all,
Take this sample:
Into button1_Click I create a new F() but this form does not get disposed as I aspected (f go out of scope!).Code:public class F : Form { private System.Windows.Forms.Button button1; F() { this.button1 = new Button(); this.button1.Click += new System.EventHandler(this.button1_Click); } private void button1_Click(object sender, System.EventArgs e) { F f = new F (); f.Show(); } [STAThread] static void Main() { Forms.Application.Run(new F()); } }
The strange is that if I do this with some other class type (try with a new Class1) this get disposed!
Why they have differents behaviors?
Thanx!




Reply With Quote