Winform设置datetimepicker默认为空

窗口LOAD事件中加入代码:

this.dateTimePicker1.Format = DateTimePickerFormat.Custom;

this.dateTimePicker1.CustomFormat = " ";


在datetimepicker的valuechange事件中加入代码:

this.dateTimePicker1.Format = DateTimePickerFormat.Long;

this.dateTimePicker1.CustomFormat = null;

你可能感兴趣的:(Winform设置datetimepicker默认为空)