Quote Originally Posted by firoz.raj View Post
in the following example.how should i clean the form object??? .let me know please.
Code:
 private void button1_Click(object sender, EventArgs e)
        {
            Form frm = new Form();
             frm.ShowDialog();
        }
The frm object will be cleaned up as soon as there are no references remaining to it.

In this instance, as soon as the button1_Click function completes. This is because ShowDialog opens the form as a modal form, and the method waits for it to return before exiting.