How to select all text in Winforms NumericUpDown upon tab in?

Aidan Ryan picture Aidan Ryan · Feb 20, 2009 · Viewed 31.4k times · Source

When the user tabs into my NumericUpDown I would like all text to be selected. Is this possible?

Answer

Jon B picture Jon B · Feb 20, 2009
private void NumericUpDown1_Enter(object sender, EventArgs e)
{
    NumericUpDown1.Select(0, NumericUpDown1.Text.Length);
}

(Note that the Text property is hidden in Intellisense, but it's there)