Category / Section
How to add appointment in WinForms ScheduleControl?
1 min read
Adding appointment item
You can add the appointment item in Schedule control by implementing the IScheduleAppointment to extend or modify the information managed by the ScheduleAppointment class. The IScheduleAppointment class is used to add the appointment items and save it to the datasource.
C#
private void buttonAdv1_Click(object sender, EventArgs e) { // Add appointment item -1 ArrayListDataProvider dataprovider = new Syncfusion.Schedule.ArrayListDataProvider(); IScheduleAppointment appointment = dataprovider.NewScheduleAppointment(); appointment = dataprovider.NewScheduleAppointment(); // appointment Date & Start time ( 12.00 Pm) appointment.StartTime = new System.DateTime(2015, 01, 21, 12, 0, 0); // End time ( 12.30 Pm) appointment.EndTime = DateTime.Now.AddMinutes(30); appointment.AllDay = true; appointment.Subject = "Business"; appointment.LabelValue = 1; dataprovider.AddItem(appointment); // Save to datasource this.scheduleControl1.DataSource = dataprovider; }
VB
Private Sub buttonAdv1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles buttonAdv1.Click ' Add appointment item -1 Dim dataprovider As ArrayListDataProvider = New Syncfusion.Schedule.ArrayListDataProvider() Dim appointment As IScheduleAppointment = dataprovider.NewScheduleAppointment() appointment = dataprovider.NewScheduleAppointment() ' appointment Date & Start time ( 12.00 Pm) appointment.StartTime = New System.DateTime(2015, 01, 21, 12, 0, 0) ' End time ( 12.30 Pm) appointment.EndTime = DateTime.Now.AddMinutes(30) appointment.AllDay = True appointment.Subject = "Business" appointment.LabelValue = 1 dataprovider.AddItem(appointment) ' Save to datasource Me.scheduleControl1.DataSource = dataprovider End Sub
Samples: