private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { int index = dataGridView1.Rows.GetFirstRow(DataGridViewElementStates.Selected); if (index != -1) { String titre = dataGridView1.Rows[index].Cells[1].Value.ToString(); String typelieu = dataGridView1.Rows[index].Cells[2].Value.ToString(); int idlieu = int.Parse(dataGridView1.Rows[index].Cells[0].Value.ToString()); int X = int.Parse(dataGridView1.Rows[index].Cells[3].Value.ToString()); int Y = int.Parse(dataGridView1.Rows[index].Cells[4].Value.ToString()); int eX = int.Parse(dataGridView1.Rows[index].Cells[5].Value.ToString()); int eY = int.Parse(dataGridView1.Rows[index].Cells[6].Value.ToString()); Form mdiparent = this.MdiParent; this.Close(); Form newMDIChild; if(typelieu.Trim() == "Stockage unitaire") newMDIChild = new AfficherLieuStoU(idlieu); else newMDIChild = new AfficherLieu(idlieu); // Set the Parent Form of the Child window. newMDIChild.MdiParent = mdiparent; // Display the new form. newMDIChild.StartPosition = FormStartPosition.Manual; newMDIChild.SuspendLayout(); newMDIChild.Location = new System.Drawing.Point(0, 0); newMDIChild.ResumeLayout(); newMDIChild.Show(); } }
private void btnRetourAfficherLieu_Click(object sender, EventArgs e) { Form mdiparent = this.MdiParent; this.Close(); Form newMDIChild = new AfficherLieu(idlieu); // Set the Parent Form of the Child window. newMDIChild.MdiParent = mdiparent; // Display the new form. newMDIChild.StartPosition = FormStartPosition.Manual; newMDIChild.SuspendLayout(); newMDIChild.Location = new System.Drawing.Point(0, 0); newMDIChild.ResumeLayout(); newMDIChild.Show(); }