ComponentOne Scheduler for WinForms
Assigning Predefined Availabilities to an Appointment
Working with Scheduler for WinForms > Appointments > Availability > Assigning Predefined Availabilities to an Appointment

Availabilities can be assigned in code or at run time through the Appointment dialog box. The following code, added the Form_Load event, assign a Tentative availability to an 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)

' Assign a predefined availability to the appointment.           
app.BusyStatus = Me.C1Schedule1.DataStorage.StatusStorage.Statuses(C1.C1Schedule.StatusTypeEnum.Tentative)        
' OR app.BusyStatus = Me.C1Schedule1.DataStorage.StatusStorage.Statuses.Item(3)           
   
' Set the view to Work Week to view the avilability.           
Me.C1Schedule1.ViewType = C1.Win.C1Schedule.ScheduleViewEnum.WorkWeekView

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); 
    
// Assign a predefined availability to the appointment.           
app.BusyStatus = this.c1Schedule1.DataStorage.StatusStorage.Statuses[C1.C1Schedule.StatusTypeEnum.Tentative];        
// OR app.BusyStatus = this.c1Schedule1.DataStorage.StatusStorage.Statuses[3];   

// Set the view to Work Week to view the availability.           
this.c1Schedule1.ViewType = C1.Win.C1Schedule.ScheduleViewEnum.WorkWeekView;

Note that either the StatusTypeEnum enumeration or the Index can be used to set the availability.

At run time, the availability can be set in the Appointment dialog box by setting the Show time as drop-down to one of the available options.