How to set win forms datetime picker to have no default value?

后端 未结 5 2132
你的背包
你的背包 2021-01-20 00:25

I am implementing search functionality in WinForms and I search by date range. Thus there are dateForm and dateTo date pickers on the form. By default their values are date

5条回答
  •  南方客
    南方客 (楼主)
    2021-01-20 00:40

    You can set DateDateTimePicker.Format property to Custom.

    Then set DateDateTimePicker.CustomFormat property to your default text (e.g "N/A" or a space " ")

    After the user has selected a certain date value, you should set back the format property to short etc.

    example

    Hope this helps!

提交回复
热议问题