G
Guest
I'm using a number of NumericUpDown controls on my form, which controls
printer settings such as number of pages.
However I want to override one of the default behaviours of the control,
namely when it is tabbed into (selected), I want the number that is displayed
in it to become selected, so the user can just type straight over it.
For this I'm using the event handler:
private void UpDown_Enter(object sender, System.EventArgs e)
{
NumericUpDown n = (NumericUpDown)sender;
n.Select(0, n.Value.ToString().Length);
}
I notice that the NumericUpDown only has a Value property, which is a
decimal, but will the ToString method of this always give the text that is
actually displayed in the control? i.e. will this be robust?
printer settings such as number of pages.
However I want to override one of the default behaviours of the control,
namely when it is tabbed into (selected), I want the number that is displayed
in it to become selected, so the user can just type straight over it.
For this I'm using the event handler:
private void UpDown_Enter(object sender, System.EventArgs e)
{
NumericUpDown n = (NumericUpDown)sender;
n.Select(0, n.Value.ToString().Length);
}
I notice that the NumericUpDown only has a Value property, which is a
decimal, but will the ToString method of this always give the text that is
actually displayed in the control? i.e. will this be robust?