private void editEntry(ICalendarEntry entry) { if (entry.GetType() == typeof(RecurringCalendarEntry)) { using (RecurringAppointmentForm newAppointmentForm = new RecurringAppointmentForm((RecurringCalendarEntry)entry)) { if (newAppointmentForm.ShowDialog() == DialogResult.OK) { RefreshDailyView(); } } } else if (entry.GetType() == typeof(SingleCalendarEntry)) { using (SingleAppointmentForm newAppointmentForm = new SingleAppointmentForm((SingleCalendarEntry)entry)) { if (newAppointmentForm.ShowDialog() == DialogResult.OK) { RefreshDailyView(); } } } }