ComponentOne Scheduler for WinForms
Adding Contacts to the Master Contact List
Working with Scheduler for WinForms > Appointments > Contacts > Adding Contacts to the Master Contact List

C1Schedule supports contacts created in code or at run time through the Master Contact List dialog box. The following code, added to the Form_Load event, creates a contact for John Smith:

To write code in Visual Basic

Visual Basic
Copy Code
' Create the contact.        
Dim contcol As C1.C1Schedule.ContactCollection        
contcol = Me.C1Schedule1.DataStorage.ContactStorage.Contacts        
Dim contact As New C1.C1Schedule.Contact       
contact.Text = "John Smith"

' Insert the contact into the Master Contact List.      
contcol.Insert(0, contact)

To write code in C#

C#
Copy Code
// Create the contact.        
C1.C1Schedule.ContactCollection contcol;        
contcol = this.c1Schedule1.DataStorage.ContactStorage.Contacts;        
C1.C1Schedule.Contact contact = new C1.C1Schedule.Contact();        
contact.Text = "John Smith";

// Insert the contact into the Master Contact List.        
contcol.Insert(0, contact);

At run time, creating a contact can be added through the Master Contact List dialog box. Clicking the Master Contact List button in the Contacts dialog box opens the Master Contact List dialog box where you add or delete contacts.

After you create a contact or contacts, add the contact to the appointment in the Contacts dialog box. For more details on how to add a contact to an appointment, see Assigning Contacts to an Appointment.