How can I make a DateTimePicker display an empty string?

后端 未结 8 671
不知归路
不知归路 2020-11-28 08:12

I would like to be able to display a DateTimePicker that has a default value of nothing, i.e. no date.

For example, I have a start date dtTaskStar

8条回答
  •  -上瘾入骨i
    2020-11-28 08:53

    Just set the property as follows:

    When the user press "clear button" or "delete key" do

    dtpData.CustomFormat = " "  'An empty SPACE
    dtpData.Format = DateTimePickerFormat.Custom
    

    On DateTimePicker1_ValueChanged event do

    dtpData.CustomFormat = "dd/MM/yyyy hh:mm:ss"
    

提交回复
热议问题