private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { string fname, sname, oname; if (e.RowIndex >= 0) { DataGridViewRow row = this.dataGridView1.Rows[e.RowIndex]; //assigning data gride field to control //using their index/ numeric position starting from zero label1.Text = row.Cells[0].Value.ToString(); selectClass.selectImage(label1.Text, pictureBox1); fname = row.Cells[1].Value.ToString(); sname = row.Cells[2].Value.ToString(); oname = row.Cells[3].Value.ToString(); txtEmpname.Text = fname + " " + sname + " " + oname; txtdepartment.Text = row.Cells[5].Value.ToString(); txtresidence.Text = row.Cells[7].Value.ToString(); txtqualification.Text = row.Cells[8].Value.ToString(); txtEmpPhone.Text = row.Cells[9].Value.ToString(); txtemail.Text = row.Cells[10].Value.ToString(); txtreference.Text = row.Cells[13].Value.ToString(); txtrefcontact.Text = row.Cells[14].Value.ToString(); } }
private void button1_Click(object sender, EventArgs e) { selectClass.selectImage(txtPatID.Text.Trim(), pictImage); selectClass.selectname(txtPatID.Text.Trim()); txtPatName.Text = selectClass.fullName; }