private void btnAdd_Click(object sender, EventArgs e) { bool open = false; foreach (Form f in Application.OpenForms) { if (f == o) { open = true; } } if (!open) { o = new Ocorrencia(); o.Show(); } else { o.Focus(); } }
private void btnEdit_Click(object sender, EventArgs e) { bool open = false; foreach (Form f in Application.OpenForms) { if (f == o) { open = true; } } if (!open) { o = new Ocorrencia(dGVOco.SelectedRows[0].Cells[0].FormattedValue.ToString()); o.Show(); } else { o.Focus(); } }