title: Selecting value in datagrid using KeyUp event
body: <p>i want to display the selected value in datagridview to textfields by using <code>KeyUp</code> and <code>KeyDown</code> events </p>
  
  <pre><code>private void gridView_KeyUp(object sender, KeyEventArgs e)
  {
      try
      {
          //if (e.RowIndex &gt;= 0)
          if(e.KeyCode == Keys.Up)
          {
              DataGridViewRow row = this.gridView.Rows[e.KeyCode];
  
              txtboxStudentNum.Text = row.Cells["ID_Number"].Value.ToString();
              txtboxName.Text = row.Cells["Name"].Value.ToString();
              comboCourse.SelectedItem = row.Cells["Course"].Value.ToString();
              EPCdisplay.Text = row.Cells["EPCNumber"].Value.ToString();
              txtboxSerialNum.Text = row.Cells["SerialNumber"].Value.ToString();
              txtboxModelNum.Text = row.Cells["ModelNumber"].Value.ToString();
              comboCategory.SelectedItem = row.Cells["Category"].Value.ToString();
              comboYrLevel.SelectedItem = row.Cells["Level"].Value.ToString();
              txtboxEquipDesc.Text = row.Cells["EquipDesc"].Value.ToString();
              comboSem.Text = row.Cells["Semester"].Value.ToString();
  
  
              AddDatabase get_image = new AddDatabase();
              get_image.ID = txtboxStudentNum.Text;
              get_image.getimage();
  
  
          }
      }
      catch (Exception ex)
      {
          MessageBox.Show(ex.Message);
      }
  } 
  </code></pre>