private void btnAdd_Click(object sender, EventArgs e) { DlgAutoCatSelect dlg = new DlgAutoCatSelect(Autocats, current.Name); DialogResult res = dlg.ShowDialog(); if (res == DialogResult.OK) { foreach (AutoCat ac in dlg.AutoCatList) { if (ac.Selected && !InGroup(ac.Name)) { lbAutocats.Items.Add(ac.Name); } } } }
private void btnAdd_Click(object sender, EventArgs e) { using (DlgAutoCatSelect dialog = new DlgAutoCatSelect(Autocats, current.Name)) { DialogResult result = dialog.ShowDialog(); if (result != DialogResult.OK) { return; } foreach (AutoCat autoCat in dialog.AutoCatList) { if (autoCat.Selected && !InGroup(autoCat.Name)) { lbAutocats.Items.Add(autoCat.Name); } } } }