Check if NumericUpDown is empty

Alan Mcgilvray picture Alan Mcgilvray · Feb 25, 2013 · Viewed 12.7k times · Source

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.

Answer

christopher picture christopher · Feb 25, 2013
if(NumericUpDown1.Text == "")
{
     // If the value in the numeric updown is an empty string, replace with 0.
     NumericUpDown1.Text = "0";
}