Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
100
UltraDateTimeEditor - How to highlight individual date/time components?
posted

 The standard WinForms DateTimePicker, when you click on it, highlights the portion of the date/time you clicked (the year, the month, the minute, etc). How can I get the UDTE to have the same behaviour?

 

I tried hooking up to the AfterEnterEditMode event and setting the SelectionStart and SelectionLength. That didn't really work; if I tab into the control I can set the initial position, but if I mouse click on the control the cursor goes to whichever portion of the DT I click on and doesn't have a selection anylonger.

 

Thanks for any help

- Josh

  • 71886
    Offline posted

    Hello Josh,

    You could try setting the SelectionLength in the 'AfterCloseUp' event. Something similar to the following:

    private void ultraDateTimeEditor1_AfterCloseUp(object sender, EventArgs e)

    {

          ultraDateTimeEditor1.Editor.SelectionLength = 2;

    }

    Please do not hesitate to ask if something comes up.