ZombieKnifer223 ZombieKnifer223 - 1 year ago 105
C# Question

How have a form open on button click in Visual Studio 2015?

I am trying to find the right syntax and code that will open a Form (settings.cs) so the user can edit my program to their likings!

  • I don't want the current form to close.

Answer Source

You will need to add a form either dynamically or in the gui. I'd advise to use the gui as formatting can be iffy when done dynamically. As far as calling a form you must use the following:

void btnSettings_On_Click(){
Form somename = new YourFormName();
somename.Show() // or somename.ShowDialog(); if you want the new form to have priority until it is closed
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download