Here is some code:
1) Here where the new/child form is being launched:
Expand|Select|Wrap|Line Numbers
- Form newForm = new QueryResearchGridControl();
- newForm.MdiParent = null;
- newForm.TopLevel = true;
- newForm.ShowDialog();
- newForm.MdiParent = this;
Expand|Select|Wrap|Line Numbers
- //This was a Control, now it is a form with a Control:
- public partial class QueryResearchGridControl : Form
- {
- public QueryResearchGridControl()
- {
- TopLevel = false;
- InitializeComponent();
- }
- private IResearchGridBusinessObject busObject;
- private BaseResearchGridForm myParent;
- public void Initialize(BaseResearchGridForm parent)
- {
- myParent = parent;
- busObject = parent.BusinessObject;
- }
So as you probably notice that when MdiParent is being nulled out in item 1 above, it is causing the busObject to be null.