ComponentOne Scheduler for WinForms
Assigning Custom Labels to an Appointment
Working with Scheduler for WinForms > Appointments > Labels > Assigning Custom Labels to an Appointment

You can also add custom labels using the Label property. The following code, added to the Form_Load event, assigns a custom Meeting label 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 custom label to the appointment.           
app.Label = New C1.C1Schedule.Label(Color.DeepSkyBlue, "Meeting", "Meeting")

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 custom label to the appointment.        
app.Label = new C1.C1Schedule.Label(Color.DeepSkyBlue, "Meeting", "Meeting");