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
5549
UltraDateTime when jump with tab key the date sometimes date not selected
posted

hi, i have 3 ultradatetime controls on my Windows form. when i jump with the tab key from one to the other datetimecontrol the Shown date will not selected. often i see only the Cursor in the datefield

Parents
No Data
Reply
  • 21795
    Offline posted

    Hello Martin,

    This is expected behavior. Each UltraDateTimeEditor records the caret position and the selection, if any, when you leave the editor or when it loses focus. When it gains focus again it puts the caret where it was and selects the same part of text. If what you need is to select all the text, when UltraDateTimeEditor gains focus you may handle Enter event. In the event handler call SelectAll method. You may use code like this:

    private void UltraDateTimeEditor_Enter(object sender, EventArgs e)
    {
        // Cast the sender
        var ultraDateTimeEditor = sender as UltraDateTimeEditor;

        // Return if something is wrong
        if(ultraDateTimeEditor == null)
        {
            return;
        }

        //  Call SelectAll to select the entire text of the editor
        ultraDateTimeEditor.SelectAll();
    }

    Please let me know if you have any additional questions on this matter.

Children
No Data