I am trying to load a form automatically each time I run the application. The form can also be run from a menu item. I tried to put the call into MainForm_Load or even the constructor of the MainForm, I always get "Object reference not set to an instance of an object" error somewhere deep inside the "Initialize Component" section of the child form. If I move my call to MainForm_Activate, it works but I get a new form everytime I alt-tab to another application and back.
Here is the code I used:
private void OpenCustomer()
{
frmCust = new CustomerForm();
frmCust.MdiParent = this;
frmCust.Show();
}
private void MainForm_Load(object sender, System.EventArgs e)
{
this.OpenCustomer();
}
Stephen Lee
--------------------------------
Too much to code
Too little time
--------------------------------