ComponentOne Scheduler for WinForms
Adding Custom Categories to the Master Category List
Working with Scheduler for WinForms > Appointments > Categories > Adding Custom Categories to the Master Category List

C1Schedule also supports custom categories created in code or at run time through the Master Category List dialog box. The following code, added to the Form_Load event, creates a custom Meetings category:

To write code in Visual Basic

Visual Basic
Copy Code
' Create the Meetings category.        
Dim catcol As C1.C1Schedule.CategoryCollection        
catcol = Me.C1Schedule1.DataStorage.CategoryStorage.Categories        
Dim meetings As New C1.C1Schedule.Category        
meetings.Text = "Meetings"

' Insert the Meetings category to the Master Category List.        
catcol.Insert(0, meetings)

To write code in C#

C#
Copy Code
// Create the Meetings category.        
C1.C1Schedule.CategoryCollection catcol;        
catcol = this.c1Schedule1.DataStorage.CategoryStorage.Categories;        
C1.C1Schedule.Category meetings = new C1.C1Schedule.Category();        
meetings.Text = "Meetings";

// Insert the Meetings category into the Master Category List.        
catcol.Insert(0, meetings);

At run time, creating a custom category or categories can be done through the Master Category List dialog box. Clicking the Master Category List button in the Categories dialog box opens the Master Category List dialog box where you add, remove, or reset categories.

After you create a custom category or categories, add the categories to the appointment in the Categories dialog box the same way you would add a predefined category. For more details on how to add a category to an appointment, see Assigning Predefined Categories to an Appointment.