Version

MaxDate Property (UltraCalendarInfo)

Returns or sets the maximum date allowed.
Syntax
'Declaration
 
Public Property MaxDate As Date
public DateTime MaxDate {get; set;}
Example
This example uses the MinDate and MaxDate properties to restrict the range of dates that are considered to be valid to dates that fall within the current year.

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports System.IO
Imports System.Globalization

    Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click

        '	Get the current year
        Dim currentYear As Integer = DateTime.Today.Date.Year

        '	Get the number of months in the year for the current culture's calendar
        Dim numberOfMonthsInYear As Integer = System.Globalization.CultureInfo.CurrentCulture.Calendar.GetMonthsInYear(currentYear)

        '	Get the number of days in the last month of the year
        Dim month As Infragistics.Win.UltraWinSchedule.Month = Me.ultraCalendarInfo1.GetMonth(numberOfMonthsInYear, currentYear)
        Dim numberOfDaysInMonth As Integer = month.DaysInMonth

        '	Set the MinDate property to the first day of the current year
        Me.ultraCalendarInfo1.MinDate = New DateTime(currentYear, 1, 1)

        '	Set the MaxDate property to the last day of the current year
        Me.ultraCalendarInfo1.MaxDate = New DateTime(currentYear, numberOfMonthsInYear, numberOfDaysInMonth)

    End Sub
using System.Diagnostics;
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;
using System.IO;
using System.Globalization;

		private void button1_Click(object sender, System.EventArgs e)
		{

			//	Get the current year
			int currentYear = DateTime.Today.Date.Year;

			//	Get the number of months in the year for the current culture's calendar
			int numberOfMonthsInYear = System.Globalization.CultureInfo.CurrentCulture.Calendar.GetMonthsInYear( currentYear );

			//	Get the number of days in the last month of the year
			Infragistics.Win.UltraWinSchedule.Month month = this.ultraCalendarInfo1.GetMonth( numberOfMonthsInYear, currentYear );
			int numberOfDaysInMonth = month.DaysInMonth;
			
			//	Set the MinDate property to the first day of the current year
			this.ultraCalendarInfo1.MinDate = new DateTime( currentYear, 1, 1 );

			//	Set the MaxDate property to the last day of the current year
			this.ultraCalendarInfo1.MaxDate = new DateTime( currentYear, numberOfMonthsInYear, numberOfDaysInMonth );
		
		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also