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;
}
2条答案
按热度按时间3okqufwl1#
有很多答案可以解决你的问题
How can I make a DateTimePicker display an empty string?
或
Set Null value in DateTimePicker in C#
mdfafbf12#
请参阅此处msdn