Home Forums WinForms controls Other WinForms controls How to make WinDatePicker not require leading zeroes?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #18099 |

    I was initially quite excited when I began using the WinDatePicker, but now am beginning to get concerned that it is not going to allow me to do what I want it to do. In particular, it requires that the user type a leading 0 for single digits of the date. In other words, if I wanted to enter Feb 5th, 2007, I could not simply enter the following string:
    “2/5/07”

    I would have to type the following string instead: “02/05/07”
    In other words, it forces me to type leading zeroes. What I would like to happen is for the user to be able to type a “/” and have the cursor auto advance to the next portion of the date. I thought that I would be able to do this with the keypressed event, but now I am having trouble discovering what the current text value of the control actually is. There is no “.text” field of the control for me to view the raw value before it is validated or turned into a date.

    I tried making the EditFormatProvider be “M/d/YY” but that also requires the leading zero be typed at input time, which is not as intuitive or user-friendly as I would like it to be.

    Is there a way to do what I am doing, either built-in or by inheriting/customizing this control?

    Many thanks,

    Taylor

    Imported from legacy forums. Posted by Taytay (had 2861 views)

    User (Old forums)
    Member
    Post count: 23064

    This feature was added to our feature request list. Thank you for proposing the idea !

    Imported from legacy forums. Posted by Matt (had 153 views)

    User (Old forums)
    Member
    Post count: 23064

    Not sure if this would help, but that control has a ‘TextboxArea’ property, which then exposes a .Text and .RawText property. Might help for what you are wanting to do…

    Just a thought…

    Mark

    Imported from legacy forums. Posted by messex (had 3415 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.