I have a Master Form which contains a Panel and a Couple of Buttons in it.For each button click different forms are loaded into the Panel. one of such form calls another child form on a button click using
ChildForm.ShowDialog(this)
It is a kind of dialog window which accepts a text input from the user, and that needs to updated in one of the control in its parent form.to do this i have a property which sets the input from the user to the control like this
internal String UserInput
{
get { return UserInput; }
set
{
label.Text=value;
}
}
Whenver i try to update the property like below i get an error stating 'System.InvalidCastException'.
((ParentClass)this.Owner).Property= "User Input";
this.owner of the child form shows my master form as its owner even though i send owner details to the child form while calling Showdialog(this).
if am not loading form to the panel everything works fine. Problem occurs only when the forms are loaded to the Panel
Please suggest a solution for this.