#Region " CreateAppointmentsDataTable "
'Create the structure of the Appointments Table
Private Function CreateAppointmentsDataTable() As DataTable
Dim newTable As DataTable = New DataTable()
'Basic Appointment properties
' In order to function properly, the table must contain data for
' Subject, StartDateTime, and EndDateTime. These three fields are
' required for an appointment. So all of these will have DefaultValues.
newTable.Columns.Add("Subject", GetType(String))
newTable.Columns("Subject").DefaultValue = "New Appointment"
newTable.Columns.Add("StartDateTime", GetType(DateTime))
newTable.Columns("StartDateTime").DefaultValue = DateTime.Now
newTable.Columns.Add("EndDateTime", GetType(DateTime))
newTable.Columns("EndDateTime").DefaultValue = DateTime.Now.AddHours(1)
newTable.Columns.Add("Description", GetType(String))
' All other fields are Optional.
'Properties for AllDayEvents
newTable.Columns.Add("AllDayEvent", GetType(Boolean))
newTable.Columns("AllDayEvent").DefaultValue = False
'Properties for Reminders
newTable.Columns.Add("ReminderEnabled", GetType(Boolean))
newTable.Columns("ReminderEnabled").DefaultValue = False
newTable.Columns.Add("ReminderInterval", GetType(Integer))
newTable.Columns.Add("ReminderUnits", GetType(Integer))
'Properties when imports owners
newTable.Columns.Add("OwnerKey", GetType(String))
'Properties when imports recurring appointments.
newTable.Columns.Add("RecurrenceId", GetType(System.Guid))
newTable.Columns.Add("Recurrence", GetType(Byte()))
newTable.Columns.Add("OriginalStartDateTime", GetType(DateTime))
'DataKey is an extra field that can be used to link the appointment to some external data.
newTable.Columns.Add("DataKey", GetType(String))
'All properties
' Any other Appointment properties not covered above are stored as
' Binary data in the AllProperties field. This includes properties like
' BarColor, Location, etc.
newTable.Columns.Add("AllProperties", GetType(Byte()))
Return newTable
End Function
#End Region
#Region " SetAppointmentBindings"
'Set the Data Bindings for Appointments
Private Sub SetAppointmentBindings()
' Get the data
Me.scheduleData.Tables.Add( Me.CreateAppointmentsDataTable() )
' Set the BindingContextControl so the component will use the same context
' that the grid and any other controls on the form are using.
Me.ultraCalendarInfo1.DataBindingsForAppointments.BindingContextControl = Me
' Basic Appointment properties
Me.ultraCalendarInfo1.DataBindingsForAppointments.SubjectMember = "Subject"
Me.ultraCalendarInfo1.DataBindingsForAppointments.DescriptionMember = "Description"
Me.ultraCalendarInfo1.DataBindingsForAppointments.StartDateTimeMember = "StartDateTime"
Me.ultraCalendarInfo1.DataBindingsForAppointments.EndDateTimeMember = "EndDateTime"
Me.ultraCalendarInfo1.DataBindingsForAppointments.AllDayEventMember = "AllDayEvent"
Me.ultraCalendarInfo1.DataBindingsForAppointments.ReminderEnabledMember = "ReminderEnabled"
Me.ultraCalendarInfo1.DataBindingsForAppointments.ReminderIntervalMember = "ReminderInterval"
Me.ultraCalendarInfo1.DataBindingsForAppointments.ReminderUnitsMember = "ReminderUnits"
'Properties when imports owners
Me.ultraCalendarInfo1.DataBindingsForAppointments.OwnerKeyMember = "OwnerKey"
'Properties when imports recurring appointments.
Me.ultraCalendarInfo1.DataBindingsForAppointments.RecurrenceIdMember = "RecurrenceId"
Me.ultraCalendarInfo1.DataBindingsForAppointments.RecurrenceMember = "Recurrence"
Me.ultraCalendarInfo1.DataBindingsForAppointments.OriginalStartDateTimeMember = "OriginalStartDateTime"
' All other properties
Me.ultraCalendarInfo1.DataBindingsForAppointments.AllPropertiesMember = "AllProperties"
'DataKey is an extra field that can be used to link the appointment to some external data.
Me.ultraCalendarInfo1.DataBindingsForAppointments.DataKeyMember = "DataKey"
' DataSource & DataMember
Me.ultraCalendarInfo1.DataBindingsForAppointments.SetDataBinding(Me.scheduleData, string.Empty)
End Sub
#End Region