private void btnCreateEvent_Click(object sender, EventArgs e) { Event _event = null; EditEventForm editEventForm = new EditEventForm(); if (editEventForm.ShowDialog() == DialogResult.OK) { _event = editEventForm.GetEvent(); listBoxEvents.Items.Add(_event); } }
private void btnEditEvent_Click(object sender, EventArgs e) { if (listBoxEvents.SelectedItem == null) { return; } Event _event = null; EditEventForm editEventForm = new EditEventForm(); editEventForm.SetEvent((Event)listBoxEvents.SelectedItem); if (editEventForm.ShowDialog() == DialogResult.OK) { _event = editEventForm.GetEvent(); listBoxEvents.Items[listBoxEvents.SelectedIndex] = _event; } }