How to open a new window in Windows Forms in .NET?

I have an application that among other things has an Edit Button and when the user clicks on that button I want a new window to open with various textboxes for editing purposes.

I can create a new window with code like

Form editform = new Form();

But I want to design that window in the Designer too.

Answers


In Visual Studio, right-click on your project and select Add->Windows Form. That will give you a new form to work with. Lay it out how you want. Then you can launch the window from your main window with code similar to the following:

MyEditForm form = new MyEditForm();
form.Show();

To answer Rick's comment on Brian's answer:

        using (var login = new Login())
        {
            switch(login.ShowDialog())
            {
                case DialogResult.OK:
                    Application.Run(new Studio());
                break;
            }
        }

Need Your Help

Best Practices for Laravel 4 Helpers and Basic Functions?

laravel laravel-4 laravel-blade laravel-helper

I'm trying to understand the best place to put a global function in Laravel 4. For example, date formatting. I don't think making a facade is worth it as facades are too modular. I've read articles...