private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { int selectedrowindex = dataGridView1.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = dataGridView1.Rows[selectedrowindex]; string a = Convert.ToString(selectedRow.Cells[1].Value); foreach (Form form in Application.OpenForms) if (form.Name == "News") { form.Close(); break; } frm_News newMDIchild = new frm_News(); newMDIchild.MdiParent = this.MdiParent; newMDIchild.Tag = selectedRow; newMDIchild.Show(); }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { int selectedrowindex = dataGridView1.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = dataGridView1.Rows[selectedrowindex]; string a = Convert.ToString(selectedRow.Cells[1].Value); foreach (Form form in Application.OpenForms) { if (form.Name == "News") { form.Close(); break; } } frm_News newMDIchild = new frm_News(); newMDIchild.MdiParent = this.MdiParent; newMDIchild.Tag = selectedRow; newMDIchild.Show(); }