private void Form_Load(object sender, EventArgs e) { numericUpDown1.Focus(); }
private void numericUpDown1_Enter(object sender, EventArgs e) { // Perform actions when control receives focus } private void numericUpDown1_Leave(object sender, EventArgs e) { // Perform actions when control loses focus }This example demonstrates how to handle the focus events for a NumericUpDown control. The "Enter" event will be triggered when the control receives focus, while the "Leave" event will be triggered when the control loses focus. These events can be used to perform actions such as validation or formatting of the entered value. Package library: System.Windows.Forms (included in the .NET Framework)