title: Copy DataGridView values to TextBox
body: <p>I have tried to get an answer to this but so far no help has been able to do what I want it to.</p>
  
  <p>I have this piece of code, which is meant to look at the selected row and output it's columns into the corresponding text boxes.</p>
  
  <pre><code> private void DataGridView01_SelectionChanged(object sender, EventArgs e)
   {
      if (DataGridView01.SelectedRows.Count &gt; 0)
      {
         personIDTextBox.Text = DataGridView01.SelectedRows[0].Cells[0].Value.ToString();
         comboBox1.Text = DataGridView01.SelectedRows[0].Cells[1].Value.ToString();
         Txt_FirstName.Text = DataGridView01.SelectedRows[0].Cells[2].Value.ToString();
         mIDDLENAMETextBox.Text = DataGridView01.SelectedRows[0].Cells[3].Value.ToString();
         sURNAMETextBox.Text = DataGridView01.SelectedRows[0].Cells[4].Value.ToString();
         cITYTextBox.Text = DataGridView01.SelectedRows[0].Cells[5].Value.ToString();
         eMAILTextBox.Text = DataGridView01.SelectedRows[0].Cells[6].Value.ToString();
       }
    }
  </code></pre>
  
  <p>When I launch the program, I get no errors but it doesn't output the data into the textbox. Anyone know what I am doing wrong?</p>