Category / Section
How to get the details of the selected appointment in WinForms ScheduleControl?
1 min read
Retrieve the selected appointment details
The selected appointment from ScheduleControl can be retrieved by using the SelectedAppointments property of ScheduleGrid as shown in the following code example.
C#
private void getSelectedAppointmentsBtn_Click(object sender, EventArgs e) { foreach (IScheduleAppointment appointment in this.scheduleControl1.GetScheduleHost().SelectedAppointments) { MessageBox.Show("Appointment Date is " + appointment.StartTime.ToLongDateString() + "\n" + "Start Time is " + appointment.StartTime.ToLongTimeString() + "\n" + "End Time is " + appointment.EndTime.ToLongTimeString() + "\n" + "Subject is " + appointment.Subject.ToString() + "\n" + "Location is " + appointment.LocationValue.ToString()); } }
VB
Private Sub getSelectedAppointmentsBtn_Click(ByVal sender As Object, ByVal e As EventArgs) Handles getSelectedAppointmentsBtn.Click For Each appointment As IScheduleAppointment In Me.scheduleControl1.GetScheduleHost().SelectedAppointments MessageBox.Show("Appointment Date is " & appointment.StartTime.ToLongDateString() + Constants.vbLf & "Start Time is " & appointment.StartTime.ToLongTimeString() + Constants.vbLf & "End Time is " & appointment.EndTime.ToLongTimeString() + Constants.vbLf & "Subject is " & appointment.Subject.ToString() & Constants.vbLf & "Location is " & appointment.LocationValue.ToString()) Next appointment End Sub
Note:
The Syncfusion.Grid.Windows.dll has to be added in your application to access the “SelectedAppointments” property.
Screenshot:
Figure 1: SelectedAppointments
Samples: