ParentForm is really a property to get the form that your control is sited
on, (which is very handy for MDI forms). Try using "Parent" instead:
In your calling form (FormMain):
ChildForm cf = new ChildForm();
cf.Parent = this;
cf.Show();
Then in your child form:
((FormMain)this.Parent).loggedIn = true;
"Jesse" <je*****@hotmail.com> wrote in message
news:eW**************@TK2MSFTNGP12.phx.gbl...
Hi All,
Just wanted to know how to update a public variable in a parent form from
a dialog box. It appears that i get a null reference error when assigning
the variable as follows:
((FormMain)this.ParentForm).loggedIn = true;
Can anybody shed some light?
Thanks,
Jesse