I created 2 winforms in one i create a button .when i click the button i want to go to the next form(form2) and close the form1.
plz give me the code .
this is my code it is not working
form1
namespace MyTest1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void formcls()
{
this.Close();
}
private void button1_Click(object sender, EventArgs e)
{
Form2 fm2 = new Form2();
fm2.Show();
}
}
}
form2
namespace MyTest1
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
Form1 fm = new Form1();
fm.formcls();
}
}
}