Scheduler for WinForms Quick Start

In this section you'll learn how to use the basic Scheduler for WinForms functionality to create a simple scheduling application. This section is not intended to be a comprehensive tutorial of all features of Scheduler for WinForms, but rather provide a quick introduction and highlight some general approaches to using the product.

In the following quick start guide, you'll create a simple scheduling application and customize its appearance, bind your scheduling application to a data source, customize the calendar, and explore some of the run-time functionality Scheduler for WinForms provides.

To create a simple WinForms application in .NET for FlexChart control, complete the following steps: 
  1. Create a new Windows Forms application.
  2. Add a SplitContainer control to the form and set its Orientation property to Horizontal.
  3. If the SplitContainer is not docked on the form, set its Dock property to Fill.
  4. Select Panel1, the top pane of the SplitContainer, and add a C1Calendar control to the form within the pane.
  5. Set C1Calendar1's Dock property to Fill.
  6. Select Panel2, the bottom pane of the SplitContainer, and add a C1Schedule control to the form within the pane.
  7. Set C1Schedule1's Dock property to Fill.
  8. Switch to code view and create a DataTable to fetch data from the data source through OLEDB adapters.
    C#
    Copy Code
    DataTable dt = new DataTable();
    string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
                 System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
                 @"ComponentOne Samples\Common\C1NWind.mdb") + ";";
    OleDbConnection conn = new OleDbConnection(connectionString);
    OleDbDataAdapter adapter = new OleDbDataAdapter("Select * from Appointments", conn);
    adapter.Fill(dt);
    
  9. Connect the Scheduler control to c1nwind.mdb file with various data fields.
    C#
    Copy Code
    //Bind Scheduler to the datatable
    c1Schedule1.DataStorage.AppointmentStorage.DataSource = dt;
    
  10. Bind the AppointmentStorage object to Appointments list from the datatable.                       
    C#
    Copy Code
    c1Schedule1.DataStorage.AppointmentStorage.DataMember = "Appointments";
    
  11. Map appointments after setting the datasource using the DataStorage property and MappingInfo class.
    C#
    Copy Code
    c1Schedule1.DataStorage.AppointmentStorage.Mappings.AppointmentProperties.MappingName = "Properties";           
    // Bind the Body property to a field
    c1Schedule1.DataStorage.AppointmentStorage.Mappings.Body.MappingName = "Body";
    // Bind the End property to a field
    c1Schedule1.DataStorage.AppointmentStorage.Mappings.End.MappingName = "End";
    // Bind the IdMapping property to a field
    c1Schedule1.DataStorage.AppointmentStorage.Mappings.IdMapping.MappingName = "Id";
    // Bind the Location property to a field
    c1Schedule1.DataStorage.AppointmentStorage.Mappings.Location.MappingName = "Location";
    // Bind the Start property to a field
    c1Schedule1.DataStorage.AppointmentStorage.Mappings.Start.MappingName = "Start";              
    // Bind the Subject property to a field
    c1Schedule1.DataStorage.AppointmentStorage.Mappings.Subject.MappingName = "Subject";           
    
  12. Assign values to the StartDayTimeEndDayTimeTimeIntervalTimeScale and WeekStart properties of CalendarInfo object.
    C#
    Copy Code
    // 
    c1Schedule1.CalendarInfo.StartDayTime = new TimeSpan(10, 0, 0);
    c1Schedule1.CalendarInfo.EndDayTime = new TimeSpan(21, 0, 0);
    c1Schedule1.CalendarInfo.TimeInterval = C1.C1Schedule.TimeScaleEnum.FifteenMinutes;
    c1Schedule1.CalendarInfo.TimeScale = new TimeSpan(9000000000);
    c1Schedule1.CalendarInfo.WeekStart = DayOfWeek.Monday;
    
  13. Run the project and observe the output:

    Note: WinForms .NET Edition does not include rich design-time support yet. We will enhance it in future releases.