private void btnEditSector_Click(object sender, EventArgs e) { int index = lstSegments.SelectedIndex; if (index >= 0) { FormAddSegment form = new FormAddSegment((Sector)lstSegments.SelectedItem); if (form.ShowDialog() == DialogResult.OK) { lstSegments.Items.RemoveAt(index); lstSegments.Items.Insert(index, form.Data); } } }
private void btnAddSector_Click(object sender, EventArgs e) { FormAddSegment form = new FormAddSegment(); DialogResult res = form.ShowDialog(); if (res == System.Windows.Forms.DialogResult.OK) { lstSegments.Items.Add(form.Data); } }