opening a window form from another form programmatically

c#, winforms

Solution

To open from with button click please add the following code in the button event handler

var m = new Form1();
m.Show();

Here Form1 is the name of the form which you want to open.

Also to close the current form, you may use

this.close();

Problem

I am making a Windows Forms application. I have a form. I want to open a new form at run time from the original form on a button click. And then close this new form (after 2,3 sec) programatically but from a thread other than gui main thread. - Can anybody guide me how to do it ? - Will the new form affect or hinder the things going on in the original main form ? (if yes than how to stop it ?)

Original source

Related problems