Monday, November 26, 2007

MDIParent and/or Parent Property is Null! Timing Issue

One of the problems I faced today was when I was attempting to reference some properties of the MDIParent of a child form.

The code was executing in the constructor scope of the child form. It turns out that until the Activation scope any attempt to reference the parent form will result in a null value.

So I moved the neccessary code to a method wired up to the Active event of the form and received a reference as expected.