Search code examples
c#numericupdown

Check if NumericUpDown is empty


How do I check whether the user left a NumericUpDown control empty, removing the value on it? So I can reassign it a value of 0.


Solution

  • if(NumericUpDown1.Text == "")
    {
         // If the value in the numeric updown is an empty string, replace with 0.
         NumericUpDown1.Text = "0";
    }