DateTimePicker.MaxDate DateTimePicker.MaxDate DateTimePicker.MaxDate DateTimePicker.MaxDate Property

정의

컨트롤에서 선택할 수 있는 날짜 및 시간의 최대값을 가져오거나 설정합니다.Gets or sets the maximum date and time that can be selected in the control.

public:
 property DateTime MaxDate { DateTime get(); void set(DateTime value); };
public DateTime MaxDate { get; set; }
member this.MaxDate : DateTime with get, set
Public Property MaxDate As DateTime

속성 값

컨트롤에서 선택할 수 있는 날짜 및 시간의 최대값이며,The maximum date and time that can be selected in the control. 기본값은 CurrentCulture 달력의 최소값으로 결정의 MaxSupportedDateTime 속성 및 12 월 31 일, 오전 9998 12 시.The default is determined as the minimum of the CurrentCulture's Calendar's MaxSupportedDateTime property and December 31st 9998 12 am.

예외

할당된 값이 MinDate 값보다 작은 경우The value assigned is less than the MinDate value.

할당된 값이 MaxDateTime 값보다 큰 경우The value assigned is greater than the MaxDateTime value.

예제

다음 코드 예제에서는의 새 인스턴스를 만듭니다를 DateTimePicker 제어 하 고이 초기화 합니다.The following code example creates a new instance of a DateTimePicker control and initializes it. 컨트롤의 CustomFormat 속성을 설정 합니다.The control's CustomFormat property is set. 또한 합니다 ShowCheckBox 속성을 설정 하 여 컨트롤에 표시 됩니다는 CheckBox, 및 ShowUpDown 속성을 설정 하는 컨트롤이 스핀 단추 컨트롤 (up-down 컨트롤이 라고도 함)로 표시 됩니다.Also, the ShowCheckBox property is set so that the control displays a CheckBox, and the ShowUpDown property is set so that the control is displayed as a spin button control (also known as an up-down control).

public:
   void CreateMyDateTimePicker()
   {
      // Create a new DateTimePicker control and initialize it.
      DateTimePicker^ dateTimePicker1 = gcnew DateTimePicker;
      
      // Set the MinDate and MaxDate.
      dateTimePicker1->MinDate = DateTime(1985,6,20);
      dateTimePicker1->MaxDate = DateTime::Today;
      
      // Set the CustomFormat string.
      dateTimePicker1->CustomFormat = "MMMM dd, yyyy - dddd";
      dateTimePicker1->Format = DateTimePickerFormat::Custom;
      
      // Show the CheckBox and display the control as an up-down control.
      dateTimePicker1->ShowCheckBox = true;
      dateTimePicker1->ShowUpDown = true;
   }
public void CreateMyDateTimePicker()
{
   // Create a new DateTimePicker control and initialize it.
   DateTimePicker dateTimePicker1 = new DateTimePicker();

   // Set the MinDate and MaxDate.
   dateTimePicker1.MinDate = new DateTime(1985, 6, 20);
   dateTimePicker1.MaxDate = DateTime.Today;

   // Set the CustomFormat string.
   dateTimePicker1.CustomFormat = "MMMM dd, yyyy - dddd";
   dateTimePicker1.Format = DateTimePickerFormat.Custom;

   // Show the CheckBox and display the control as an up-down control.
   dateTimePicker1.ShowCheckBox = true;
   dateTimePicker1.ShowUpDown = true;
}
   
Public Sub CreateMyDateTimePicker()
    ' Create a new DateTimePicker control and initialize it.
    Dim dateTimePicker1 As New DateTimePicker()
    
    ' Set the MinDate and MaxDate.
    dateTimePicker1.MinDate = New DateTime(1985, 6, 20)
    dateTimePicker1.MaxDate = DateTime.Today
    
    ' Set the CustomFormat string.
    dateTimePicker1.CustomFormat = "MMMM dd, yyyy - dddd"
    dateTimePicker1.Format = DateTimePickerFormat.Custom
    
    ' Show the CheckBox and display the control as an up-down control.
    dateTimePicker1.ShowCheckBox = True
    dateTimePicker1.ShowUpDown = True
End Sub 'CreateMyDateTimePicker

적용 대상

추가 정보