none
Datetimepicker control... after right arrow key RRS feed

  • Question

  • When I use the arrow keys within this control I can select Hours or minutes or seconds or AM/PM individually.  Question I have is, when I move from field to field, is there a way to capture the individual values (Hours OR Minutes OR Seconds etc) even if I don't make changes?   I don't see any such property, or Selected text or selected index.   Tried to see if the control has sub-controls where I might get these but came up with nothing.

    Thoughts?

    Tom

    Friday, February 24, 2017 5:15 PM

Answers

  • Try

    Private Sub DateTimePicker1_KeyDown(sender As Object, e As KeyEventArgs) Handles DateTimePicker1.KeyDown
        If e.KeyCode = Keys.Right Then
            Console.WriteLine(DateTimePicker1.Value)
        End If
    End Sub


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Friday, February 24, 2017 7:20 PM
    Moderator