title: How to Pass Values From a DataGridView to another Form textboxes
body: <p>i could transfer the values put now the problem is in the switch cases i make switch to be able to transfer data to several form put only the form opened put i can not do that in switch it goes to default case on running so the problem is on (FORMID) how do i use switch case Correctly here
  this is my form1 code</p>
  
  <pre><code>public partial class Form1 : Form
  {
      Form2 f2 = new Form2();
      public Form1()
      {
          InitializeComponent();
          f2.setParent(this);
          f2.MdiParent = this.MdiParent;
      }
  
      private void button1_Click(object sender, EventArgs e)
      {
          f2.Show();
          f2.Activate();
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and this form 2 code :</p>
  
  <pre><code>public partial class Form2 : Form
  {
      public int FORMID = 0;
      private Form1 f1;
      private Form3 f3;
      DataTable dt;
  
      public Form2()
      {
          InitializeComponent();
      }
  
      void load_table()
      {
          string constring = "Data Source =.; initial Catalog = business; Integrated Security=SSPI;";
          SqlConnection CN = new SqlConnection(constring);
          SqlCommand cmd = new SqlCommand("select * from T_AKARAT_BUILDING_TP", CN);
          try
          {
              SqlDataAdapter sda = new SqlDataAdapter();
              sda.SelectCommand = cmd;
              dt = new DataTable();
              sda.Fill(dt);
              BindingSource bsource = new BindingSource();
              bsource.DataSource = dt;
              dataGridView1.DataSource = bsource;
              sda.Update(dt);
          }
          catch { }
      }
  
      private void Form2_Load(object sender, EventArgs e)
      {
          load_table();
      }
  
      public void setParent(Form1 parentValue)
      {
          f1 = parentValue;
      }
  
      public void setParent(Form3 parentValue)
      {
          f3 = parentValue;
      }
  
      private void dataGridView1_DoubleClick(object sender, EventArgs e)
      {
          switch (FORMID)
          {
              case 1:
  
          f1.textBox1.Text = dt.Rows[dataGridView1.CurrentCell.RowIndex][0].ToString();
          f1.textBox2.Text = dt.Rows[dataGridView1.CurrentCell.RowIndex][1].ToString();
          this.Hide();
          break;
              case 2:
          f3.textBox1.Text = dt.Rows[dataGridView1.CurrentCell.RowIndex][0].ToString();
          f3.textBox2.Text = dt.Rows[dataGridView1.CurrentCell.RowIndex][1].ToString();
          this.Hide();
          break;
              default:
          MessageBox.Show("plz select");
          break;
          }
          this.Hide();
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I set text boxes modifiers public in form 2 but this code does not work &amp; i do not know what is missing or wrong here hope to help me</p>
  
  <p>hope some one to correct my code not giving examples please</p>