none
how to open a new window

    Question

  • Hi,
    I wanted to open a new window (form) by clicking on a button, but not sure how to do this. I'm using Visual C# 2005 (which includes .net) and using the Windows Application project.

    Thanks
    Bruce
    Wednesday, November 16, 2005 6:55 AM

All replies

  • Hi...

    You could create the form. And with clicking on your button, you call the form's constructor by creating an object. And with this object you call the form's show()-method.

    Greetz,
    Finch.
    Wednesday, November 16, 2005 7:14 AM
  • In your button event handler write:



    void YourButton_Click(object sender, System.EventArgs e) {
       Form myForm = new Form();
       myForm.Show();
    }

     
    Wednesday, November 16, 2005 10:38 AM
    Moderator