MonthCalendar.SetDate(DateTime) 方法

定義

將日期設為目前的選取日期。

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

參數

date
DateTime

要選取的日期。

例外狀況

該值小於允許的最小日期。

-或-

該值大於允許的最大日期。

僅當 MinDateMaxDate 已明確設定,才會擲回這個例外狀況。

備註

這個方法會將 SelectionEnd 和 屬性設定 SelectionStart 為指定的日期。 這個方法的功能相當於透過 方法或 SelectionRange 屬性將選取範圍設定為單一天 SetSelectionRange

適用於