Majestic
Majestic

Reputation: 938

Open an empty page by clicking on menu item

I'm working on a .NET project and C#. I have to add a button which will open an empty page in the heavy client. I've never used C# before and I can not find what I'm looking for on the web (perhaps I'm doing wrong)...

So I've already add the button in the menu from the designer view and this code just appear in the code file related to the designer view :

private void customizeCVaultImportRulesToolStripMenuItem_Click(object sender, EventArgs e)
    {

    }

Does anyone know what I'm supposed to write to open an empty page in the same window? Thanks !

Upvotes: 0

Views: 774

Answers (1)

WDS
WDS

Reputation: 984

You can make a new Form and have the button click event show it, or (I think this is more common) you could just add a panel from the toolbox into the existing form, add all the controls you like to it, and make it invisible, but set it to .Show() on button click. One advantage using a Panel instead of a new Form is that all of your Form1 properties and methods remain available to you. That is, if you want them available. But normally I would use the Panel.

Upvotes: 1

Related Questions