C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Here: In this code example, we added the ValueChanged event handler by double-clicking on the NumericUpDown control.
Example of NumericUpDown and ValueChanged: C#
using System;
using System.Windows.Forms;
namespace WindowsFormsApplication12
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
// You can change other program parts when the value changes.
this.Text = "Value changed to " + numericUpDown1.Value.ToString();
}
}
}
Note: It is possible to use numbers that have decimal places in the Increment property.
Tip: This property would be useful for NumericUpDown controls that represent money amounts.
And: If you leave this on the default of True, arrow keys will change the number value up or down.
And: The UpDownAlign property allows you to change the location of the arrow buttons—here you can select Left or Right.