Why forms dosn't dispose?
Hi all,
Take this sample:
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());
}
}
Into button1_Click I create a new F() but this form does not get disposed as I aspected (f go out of scope!).
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!