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