When users have to enter data in numerous numeric up down and tab between them, they can't just key the new amount.
Say 1 is in the numeric up down they have just tabbed to and they type 2, it will go to 21 (instead of 2 which they wanted).
So for this I have put a bit of code on the got focus
Private Sub NumericUpDown1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles NumericUpDown1.GotFocus
Me.NumericUpDown1.Select(0, Me.NumericUpDown1.Value.ToString.Length)
End Sub
Private Sub NumericUpDown2_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles NumericUpDown2.GotFocus
Me.NumericUpDown2.Select(0, Me.NumericUpDown1.Value.ToString.Length)
End Sub
This selects the whole value and allows them to type.
Why does the control not just behave like this in the first place?
Also I'm toying with setting background colours to yellow when controls have focus and back to white when they do not, this is much better than the less subtle built in controls.
No comments:
Post a Comment