private void dataGridView1_DoubleClick(object sender, EventArgs e) { //display the selected student in the new form to edit/remove UpdateDelateStudentForm frm = new UpdateDelateStudentForm(); frm.textBoxId.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString(); frm.textboxfirstname.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString(); frm.textBoxlastname.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString(); frm.textBoxPhone.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString(); frm.textBoxAdress.Text = dataGridView1.CurrentRow.Cells[4].Value.ToString(); //for gender if (dataGridView1.CurrentRow.Cells[5].Value.ToString() == "Femele") { frm.radioButtonFemele.Checked = true; } frm.dateTimePickerBitthday.Value = (DateTime)dataGridView1.CurrentRow.Cells[6].Value; //the image byte[] pic; pic = (byte[])dataGridView1.CurrentRow.Cells[7].Value; student.Picture = new MemoryStream(pic); frm.pictureBoxStudentImage.Image = Image.FromStream(student.Picture); frm.Show(); }
private void editRemoveToolStripMenuItem_Click(object sender, EventArgs e) { UpdateDelateStudentForm frm = new UpdateDelateStudentForm(); frm.Show(this); }