Interview Question
Qus: How can we get the information from the form of a Dialog Box?
By using the Form.ParentForm property of the dialog box we can access the public members of the form. And we can explicitly convert the reference returned by the ParentForm property to appropriate type.Below code will help us to demonstrate the ParentForm property to access a property from the form.
public void GetParent()
{
string x = ((Form1)this.ParentForm).Text;
}
Answers (2)
public void GetParent()
{
string x = ((Form1)this.ParentForm).Text;
}