Search code examples
c#.netwinformsnumericupdown

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


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


Solution

  • 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)