private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { patID.Text = dataGridView1.CurrentCell.Value.ToString(); selectClass.selectConImage(patID.Text, pictureBox1); if (e.RowIndex >= 0) { DataGridViewRow row = this.dataGridView1.Rows[e.RowIndex]; textBox3.Text = row.Cells[4].Value.ToString(); textBox1.Text = row.Cells[5].Value.ToString(); textBox2.Text = row.Cells[6].Value.ToString(); } }