nallya

nallya

  • NA
  • 459
  • 474.1k

closing first form instead of hiding after showing second form in c# windows application

Dec 5 2012 1:37 AM
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.

Answers (3)