DateTimePicker.MinDate 속성

정의

컨트롤에서 선택할 수 있는 날짜 및 시간의 최소값을 가져오거나 설정합니다.

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

속성 값

컨트롤에서 선택할 수 있는 날짜 및 시간의 최소값이며, 기본값은 1/1/1753 00:00:00입니다.

예외

할당된 값이 MaxDate 값보다 큰 경우

또는

할당된 값이 MinDateTime 값보다 작은 경우

예제

다음 코드 예제에서는 컨트롤의 DateTimePicker 새 instance 만들고 초기화합니다. 컨트롤의 CustomFormat 속성이 설정됩니다. 또한 컨트롤이 ShowCheckBox 를 표시 CheckBox하도록 속성이 설정되고 ShowUpDown 컨트롤이 스핀 단추 컨트롤(업다운 컨트롤이라고도 함)으로 표시되도록 속성이 설정됩니다.

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

적용 대상

추가 정보