C# Visual Studio Open New Window

cvisual studio 2012windowwpfxaml

I am new to C# and Visual Studio,
But I started a little project that opens a main window and shows a table.
The Presenter of the window contains an Observable:

public ObservableCollection<FruitsPresenter> Fruits { get; set; }

This collections contains information about some fruits.
Then It shows a table of all i'ts content.
I made a button that supposed to open a new window and create a 'entry form'
that will ask for information and then add to the collection a new item.

I couldn't manage to do it. Any help?

Best Answer

Adding a new form and opening it is very simple in C#/Visual Studio.

Do the following:

  1. Add a new form to your project:

    Do this by right-clicking your project and choose: Add -> Windows Form.

  2. Name the form

  3. Create new instance of form and call form:

Go to the location where the new form should be called from. Add following code there:

NewForm newFrm = new NewForm();
newFrm.Show();

New form will be visible when application calls code above.