DateTimePicker: pick both date and time

前端 未结 7 1552
独厮守ぢ
独厮守ぢ 2020-11-28 04:01

Is it possible to use DateTimePicker (Winforms) to pick both date and time (in the dropdown)? How do you change the custom display of the picked value? Also, is it possible

7条回答
  •  日久生厌
    2020-11-28 04:12

    Unfortunately, this is one of the many misnomers in the framework, or at best a violation of SRP.

    To use the DateTimePicker for times, set the Format property to either Time or Custom (Use Custom if you want to control the format of the time using the CustomFormat property). Then set the ShowUpDown property to true.

    Although a user may set the date and time together manually, they cannot use the GUI to set both.

提交回复
热议问题