Version

Disable the Current Day, Week, Month, or Year

A common task for the WinSchedule™ controls is to disable a particular Day, Week, Month, Year across all the schedule views or WinCalendarCombo™. The WinCalendarInfo™ component allows you to do this, since all the schedule controls can share a WinCalendarInfo.

This topic assumes you have a WinCalendarInfo on your form, and at least one of the schedule views, or the WinCalendarCombo control on the form. Set the schedule view or WinCalendarCombo’s CalendarInfo property to the WinCalendarInfo that is also on the form.

  • To disable the current day you pass in the DateTime.Today into the GetDay method off the UltraCalendarInfo. The following example code shows how to do this.

In Visual Basic:

' Disable Today
Me.UltraCalendarInfo1.GetDay(DateTime.Today, True).Enabled = False

In C#:

// Disable Today
this.ultraCalendarInfo1.GetDay(DateTime.Today, true).Enabled = false;
  • To disable the current week you pass in the DateTime.Today into the GetWeek method off the UltraCalendarInfo. The following example code shows how to do this.

In Visual Basic:

' Disable the current Week
Me.UltraCalendarInfo1.GetWeek(DateTime.Today).Enabled = False

In C#:

// Disable the current Week
this.ultraCalendarInfo1.GetWeek(DateTime.Today).Enabled = false;
  • To disable the a month that is two months from the current day you pass in the DateTime.Today.AddMonths(2) into the GetMonth method off the UltraCalendarInfo. The following example code shows how to do this.

In Visual Basic:

' Disable the month two months from the current month
Me.UltraCalendarInfo1.GetMonth(DateTime.Today.AddMonths(2)).Enabled = False

In C#:

// Disable the month two months from the current month
this.ultraCalendarInfo1.GetMonth(DateTime.Today.AddMonths(2)).Enabled = false;
  • To disable an entire year you pass in the year into the GetYear method off the UltraCalendarInfo. The following example code shows how to do this.

In Visual Basic:

' Disable the year 2008
Me.UltraCalendarInfo1.GetYear(2008).Enabled = False

In C#:

// Disable the year 2008
this.ultraCalendarInfo1.GetYear(2008).Enabled = false;