This is the first form( it contains an OK button and a textbox)
namespace Testt
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        public int dimx;
        private void button1_Click(object sender, EventArgs e)
        {
            Form2 f2 = new Form2();
            this.Hide();
            f2.ShowDialog();
            this.Show();
            dimx = int.Parse(textBox1.Text);
            MessageBox.Show(dimx.ToString());
        }
    }
}
This is the second form (it contains an OK button + a messageBox when OK is pressed)
namespace Testt
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            Form1 f=new Form1();
            MessageBox.Show(f.dimx.ToString());
        }
    }
}
I want to write the value of 6 in the textbox press OK, then form2 pops up and when i press OK on the second form it should display 6 not 0..what am i doing wrong?