private void dataGridView1_DoubleClick(object sender, EventArgs e) { editTeacherForm editTeacher = new editTeacherForm(); editTeacher.textBoxID.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString(); editTeacher.textBoxSname.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString(); editTeacher.textBoxName.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString(); editTeacher.textBoxPname.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString(); //пол if (dataGridView1.CurrentRow.Cells[4].Value.ToString() == "Женский") { editTeacher.radioButtonFemale.Checked = true; } editTeacher.dateTimePicker1.Value = (DateTime)dataGridView1.CurrentRow.Cells[5].Value; editTeacher.textBoxAddress.Text = dataGridView1.CurrentRow.Cells[6].Value.ToString(); editTeacher.textBoxMail.Text = dataGridView1.CurrentRow.Cells[7].Value.ToString(); editTeacher.textBoxMobile.Text = dataGridView1.CurrentRow.Cells[8].Value.ToString(); editTeacher.textBoxLogin.Text = dataGridView1.CurrentRow.Cells[9].Value.ToString(); editTeacher.textBoxPassword.Text = dataGridView1.CurrentRow.Cells[10].Value.ToString(); //тут изображение byte[] pic; pic = (byte[])dataGridView1.CurrentRow.Cells[11].Value; MemoryStream picture = new MemoryStream(pic); editTeacher.pictureBoxTeacherImage.Image = Image.FromStream(picture); editTeacher.ShowDialog(this); }
private void изменитьToolStripMenuItem_Click(object sender, EventArgs e) { editTeacherForm editTeacher = new editTeacherForm(); bool exit = false; for (int i = 0; i < this.MdiChildren.Length; i++) { if (this.MdiChildren[i].Name == "addTeacherForm") { exit = true; } } if (exit == false) { editTeacher.MdiParent = this; editTeacher.Show(); } }