private void btnModificar_Click(object sender, EventArgs e) { try { if (dgvResultados.RowCount > 0) { bool isModificarArticuloOpen = false; for (int i = 0; i < Application.OpenForms.Count; i++) { if (Application.OpenForms[i].GetType() == typeof(frmAltaArticulos)) { isModificarArticuloOpen = true; } } if (!isModificarArticuloOpen && dgvResultados.RowCount > 0) { frmAltaArticulos frmModificar = new frmAltaArticulos((Articulo)dgvResultados.CurrentRow.DataBoundItem, dgvResultados); for (int i = 0; i < Application.OpenForms.Count; i++) { if (Application.OpenForms[i].GetType() == typeof(frmMain)) { frmModificar.MdiParent = Application.OpenForms[i]; } } frmModificar.Show(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }