How to enumerate all Appointments between two dates in Schedule control
Use following code to enumerate all appointments between two dates in Schedule control (applies to WinForms, WPF and Silverlight):
C#:
DateTime start = new DateTime(2014, 05, 07); DateTime end = start.AddDays(10); DateTime d = start; while (d <= end) { DevComponents.Schedule.Model.Day day = calendarView1.CalendarModel.GetDay(d); foreach (Appointment item in day.Appointments) { Console.WriteLine("Appointment: {0}-{1} {2}", item.StartTime, item.EndTime, item.Subject); } d = d.AddDays(1); }
VB:
Dim startDate As New DateTime(2014, 5, 7) Dim endDate As DateTime = startDate.AddDays(10) Dim d As DateTime = start While d <= endDate Dim day As DevComponents.Schedule.Model.Day = calendarView1.CalendarModel.GetDay(d) For Each item As Appointment In day.Appointments Console.WriteLine("Appointment: {0}-{1} {2}", item.StartTime, item.EndTime, item.Subject) Next d = d.AddDays(1) End While
Related posts:
- How to use marked dates and custom styles in DotNetBar for WPF MonthCalendar
- How to show custom Tooltip for Schedule Appointments
- How to display the number of appointments for a day in month view of Silverlight Schedule.
- Silverlight Schedule Control Quick Start Guide
- Schedule Control Quick Start Guide (Silverlight)
Leave a Reply!