private void btnNewEvent_Click(object sender, EventArgs e) { using (EventForm newEventName = new EventForm()) { var result = newEventName.ShowDialog(); if (result == DialogResult.OK) { cbxEventsList.Items.Add(newEventName.EventName); } } }
private void btnEditEvent_Click(object sender, EventArgs e) { using (EventForm editEventName = new EventForm(cbxEventsList.SelectedItem.ToString())) { int eventIndex = cbxEventsList.SelectedIndex; var result = editEventName.ShowDialog(); if (result == DialogResult.OK) { cbxEventsList.Items[eventIndex] = editEventName.EventName; } } }