Highlight NumericUpDown field after tab

  • Thread starter Thread starter JoCom67
  • Start date Start date
After you what do to this field?

Coming from another field, once the tab key is pressed, it should
select (highlight) the numeric value so that when the user types in
the new value it will just override or overwrite the previous numeric
value of this field.
 
Coming from another field, once the tab key is pressed, it should
select (highlight) the numeric value so that when the user types in
the new value it will just override or overwrite the previous numeric
value of this field.

Pressing TAB brings you to NumericUpDown control normally, then all
you have to do is to handle GofFocus event as follows:


' Code Lines are splitted for a proper paste
' Select entire value
Private Sub NumericUpDown1_GotFocus _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles _
NumericUpDown1.GotFocus
NumericUpDown1.Select(0, _
NumericUpDown1.Value.ToString.Length)
End Sub


Hope this helps,

Onur Güzel
 
Pressing TAB brings you to NumericUpDown control normally, then all
you have to do is to handle GofFocus event as follows:

' Code Lines are splitted for a proper paste
' Select entire value
Private Sub NumericUpDown1_GotFocus _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles _
NumericUpDown1.GotFocus
NumericUpDown1.Select(0, _
NumericUpDown1.Value.ToString.Length)
End Sub

Hope this helps,

Onur Güzel

Thanks Onur, I tried it and it worked. Again Thanks!
 
Back
Top