private void BTN_EDIT_Click(object sender, EventArgs e) { LineupDataObj selected = (LineupDataObj)listBox1.SelectedItem; LineupMgrDlg dlg = new LineupMgrDlg(selected); if (dlg.ShowDialog(this) == DialogResult.OK) { int index = listBox1.Items.IndexOf(selected); listBox1.Items.Remove(selected); selected = dlg.WorkingLineup; listBox1.Items.Insert(index, selected); listBox1.Refresh(); BTN_SAVE.Enabled = true; } }
private void BTN_ADD_Click(object sender, EventArgs e) { LineupMgrDlg dlg = new LineupMgrDlg(); if (dlg.ShowDialog(this) == DialogResult.OK) { LineupDataObj data = dlg.WorkingLineup; storedLineups.Lineups.Add(data.getLineupData()); listBox1.Items.Add(data); } if (listBox1.Items.Count > 0) { BTN_SAVE.Enabled = true; BTN_DELETE.Enabled = true; } }