DateTimePicker.MinDate DateTimePicker.MinDate DateTimePicker.MinDate DateTimePicker.MinDate Property

정의

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

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

속성 값

컨트롤에서 선택할 수 있는 날짜 및 시간의 최소값이며,The minimum date and time that can be selected in the control. 기본값은 1/1/1753 00:00:00입니다.The default is 1/1/1753 00:00:00.

예외

할당된 값이 MaxDate 값보다 작지 않은 경우The value assigned is not less than the MaxDate value.

할당된 값이 MinDateTime 값보다 작은 경우The value assigned is less than the MinDateTime 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

적용 대상

추가 정보