public test() { AnotherForm nForm = new AnotherForm(); //Starts a form object op = nForm; // Assigns the form to be shown to the non-local variable nForm.Show(); // shows the form object to user }
private void showToolStripMenuItem_Click(object sender, EventArgs e) { anotherForm = new AnotherForm(); // when Menu Item is clicked instantiate the Form anotherForm.FormClosing += new FormClosingEventHandler(anotherForm_FormClosing); // Add a FormClosing event Handler anotherForm.ShowDialog(); }