Multiple Windows Forms on one application

Posted by Shukhrat Raimov on Stack Overflow See other posts from Stack Overflow or by Shukhrat Raimov
Published on 2012-12-16T03:19:38Z Indexed on 2012/12/16 5:04 UTC
Read the original article Hit count: 403

Filed under:
|
|

I have two windows forms, first is initial and second is invoked when button on the first is pressed. It's two different windows, with different tasks. I programmed for both MVP pattern. But in the Main() I have this:

static void Main()
{
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    ViewFirst viewFirst = new ViewFirst();//First Form
    PresenterFirst presenterFirst = new PresenterFirst(viewFirst);
    Application.Run(viewFirst);
}

And I Have Second Windows Form:

ViewSecond viewSecond = new ViewSecond();//Second Form
PresenterSecond presenterSecond = new PresenterSecond(viewSecond);

I want to run it in this app as soon as the button on the first is clicked. How could I do this? My button on the first WF is:

private void history_button_Click(object sender, EventArgs e)
{
    ViewSecond db = new ViewSecond();//second Form where I have sepparate WF.
    db.Show();
}

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms