This is my Main Form (test) code:
private void button1_Click(object sender, EventArgs e)
{
test1 test1 = new test1();
test1._valueOfForm1 = textBox1.Text;
test1._valueOfForm2 = textBox2.Text;
test1._valueOfForm3 = textBox3.Text;
//this.Close();
//test1.Show();
}
and
This is my Second Form(test1) code:
public partial class test1 : Form
{
public string _valueOfForm1 = "";
public string _valueOfForm2 = "";
public string _valueOfForm3 = "";
public test1()
{
InitializeComponent();
}
private void test1_Load(object sender, EventArgs e)
{
textBox1.Text = _valueOfForm1;
textBox2.Text = _valueOfForm2;
textBox3.Text = _valueOfForm3;
}
}
i am passing data of three textboxes from test to test1 and my need is to close the first form(NOT TO HIDE) and show data in second,all working properly
just want to close firest form(test) after showing test1
Thanks.
pavan prasadPosted Nov 10, 2015, 5:26 AM
Sivaraman DhamodaranPosted Dec 5, 2012, 4:39 AM
In the first case this.Close() should work.
In the second case, use Application.Exit() because you can not close the application window
VulpesPosted Dec 5, 2012, 4:38 AM
Why is just hiding it a problem?