This example demonstrates main features of the WinForms Scheduler control. The Scheduler control is bound to a Microsoft SQL database and "linked" to the WinForms Range Control.
Files to Review
Documentation
Does this example address your development requirements/objectives?
(you will be redirected to DevExpress.com to submit your response)
Example Code
C#using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraBars;
using DevExpress.XtraBars.Ribbon;
using DevExpress.XtraBars.Helpers;
using DevExpress.Skins;
using DevExpress.LookAndFeel;
using DevExpress.UserSkins;
namespace SampleSchedulerRangeControl
{
public partial class Form1 : RibbonForm
{
public Form1()
{
InitializeComponent();
InitSkinGallery();
schedulerControl.Start = System.DateTime.Now;
schedulerStorage.AppointmentsChanged += new DevExpress.XtraScheduler.PersistentObjectsEventHandler(schedulerStorage_AppointmentsChanged);
schedulerStorage.AppointmentsInserted += new DevExpress.XtraScheduler.PersistentObjectsEventHandler(schedulerStorage_AppointmentsInserted);
schedulerStorage.AppointmentsDeleted += new DevExpress.XtraScheduler.PersistentObjectsEventHandler(schedulerStorage_AppointmentsDeleted);
schedulerStorage.Appointments.CommitIdToDataSource = false;
schedulerControl.Start = new DateTime(2012,10,31);
}
void InitSkinGallery()
{
SkinHelper.InitSkinGallery(rgbiSkins, true);
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'carsDBDataSet.Cars' table. You can move, or remove it, as needed.
this.carsTableAdapter.Fill(this.carsDBDataSet.Cars);
// TODO: This line of code loads data into the 'carsDBDataSet.CarScheduling' table. You can move, or remove it, as needed.
this.carSchedulingTableAdapter.Fill(this.carsDBDataSet.CarScheduling);
}
void schedulerStorage_AppointmentsDeleted(object sender, DevExpress.XtraScheduler.PersistentObjectsEventArgs e)
{
Commit();
}
void schedulerStorage_AppointmentsInserted(object sender, DevExpress.XtraScheduler.PersistentObjectsEventArgs e)
{
Commit();
}
void schedulerStorage_AppointmentsChanged(object sender, DevExpress.XtraScheduler.PersistentObjectsEventArgs e)
{
Commit();
}
private void Commit()
{
carSchedulingTableAdapter.Update(carsDBDataSet);
carsDBDataSet.AcceptChanges();
}
}
}