ComponentOne Scheduler for WinForms
Appointments
Working with Scheduler for WinForms > Appointments

An appointment represents a period of time and detailed information about events that will take place during that period of time. Appointments can span from a specified duration, such as 30 minutes, to multi-day events, and can be set either in code or by binding to a data source, or at run time, either through the context menu or by clicking a specified time on the schedule.

Interval Appointments

Appointments that span a specific duration will appear on the schedule during that duration when in DayView, WeekView, or WorkWeekView views. For example, the appointment below starts at 2:00 PM and lasts 1 hour.

In the MonthView view, the appointment will appear on the calendar with the time and subject of the appointment.

Setting an Interval Appointment

Appointments can be created in code or at run time through the Appointment dialog box. The following code, added to the Form_Load event, creates a new interval appointment:

To write code in Visual Basic

Visual Basic
Copy Code
' Add a new appointment.    
Dim app As C1.C1Schedule.Appointment    
app = Me.C1Schedule1.DataStorage.AppointmentStorage.Appointments.Add()

' Set some details for the appointment.    
app.Subject = "Meeting"    
app.Location = "Large Conference Room"    
app.Duration = TimeSpan.FromMinutes(45)   
app.Start = New Date(2007, 2, 28, 13, 30, 0)

To write code in C#

C#
Copy Code
// Add a new appointment.   
C1.C1Schedule.Appointment app;     
app = this.c1Schedule1.DataStorage.AppointmentStorage.Appointments.Add(); 

// Set some details for the appointment.    
app.Subject = "Meeting";     
app.Location = "Large Conference Room";     
app.Duration = TimeSpan.FromMinutes(45);     
app.Start = new DateTime(2007, 2, 28, 13, 30, 0);

At run time, an appointment can be created through the Appointment dialog box by setting the Start time and End time drop-downs to the duration of the appointment. For more information on creating appointments at run time, see Working with Appointments.

All-Day or Multi-Day Events

Appointments that are either an all-day event or a multi-day event will appear on the schedule in the area above the schedule when in DayView, WeekView, or WorkWeekView view. For example, the appointment below represents an all-day event.

In the MonthView view, the appointment will appear on the calendar with the subject of the appointment within a box.

Setting an All-Day Appointment

Appointments can be created in code or at run time through the Appointment dialog box. The following code, added to the Form_Load event, creates a new all-day appointment:

To write code in Visual Basic

Visual Basic
Copy Code
' Create a new appointment.    
Dim app As C1.C1Schedule.Appointment    
app = Me.C1Schedule1.DataStorage.AppointmentStorage.Appointments.Add()

' Make the appointment an all day event.    
app.AllDayEvent = True
 
' Set some details for the appointment.    
app.Subject = "Training"    
app.Location = "Large Conference Room"

To write code in C#

C#
Copy Code
// Create a new appointment.    
C1.C1Schedule.Appointment app = this.c1Schedule1.DataStorage.AppointmentStorage.Appointments.Add();

// Make the appointment an all day event.    
app.AllDayEvent = true;

// Set some details for the appointment.    
app.Subject = "Training";    
app.Location = "Large Conference Room";

At run time, an appointment can be created through the Appointment dialog box by checking the All day event check box. For more information on creating appointments at run time, see Working with Appointments.

See Also