MonthCalendar.SetDate(DateTime) Method

Definition

Sets a date as the currently selected date.

public:
 void SetDate(DateTime date);
public void SetDate (DateTime date);
member this.SetDate : DateTime -> unit
Public Sub SetDate (date As DateTime)

Parameters

date
DateTime

The date to be selected.

Exceptions

The value is less than the minimum allowable date.

-or-

The value is greater than the maximum allowable date.

This exception will only be thrown if MinDate or MaxDate have been set explicitly.

Remarks

This method sets the SelectionStart and the SelectionEnd properties to the specified date. This method is the functional equivalent of setting the selection range to a single day through the SetSelectionRange method or the SelectionRange property.

Applies to