Hi John,
How to show/display the instance of the parent/calling form?
You could pass a reference of the parent/calling form to the child form
through a constructor. Then when you want to display the parent form, just
call show on the reference.
Here is some code to put in the sub form:
public class ShowParentForm : System.Windows.Forms.Form {
// Declare member variable to store reference to parent form.
private System.Windows.Forms.Form _parentForm;
// Set the parent form in the constructor.
public ShowParentForm(Form parentForm) {
InitializeComponent();
_parentForm = parentForm;
}
// Display the parent form.
private void button1_Click(object sender, System.EventArgs e) {
if (_parentForm != null) {
_parentForm.Show();
this.Close();
}
}
}
To call this:
ShowParentForm frm = new ShowParentForm(this);
frm.Show();
Hope that helps,
Tom
--
Tom Krueger
Microsoft Corporation
Program Manager
http://weblogs.asp.net/tom_krueger
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm