Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Auto Load a Form
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Auto Load a Form
Divers
Thread ID:
00770013
Message ID:
00770013
Vues:
46
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
--------------------------------
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform