Home > DeveloperSection > Forums > Validation on NumericUpDown Control in C#.Net
Tanuj Kumar

Total Post:134

Posted on    September-06-2012 12:38 AM

 C# C# 

 1 Reply(s)
 4407  View(s)
Rate this:
Hello Everyone,
I'm working with NumericUpDown Control in C#.Net and I want to user input limit validation in NumericUpDown control( Suppose that I want to user can input only three digit in numericupdown control). Let me know it as soon as possible. if possible then write down code too.

Thanks in advance!

Arun Singh

Total Post:68

Posted on    September-08-2012 12:43 AM

Hi Tanuj,
You can use following line of code to validate user:
private void numericUpDown1_KeyDown(object sender, KeyEventArgs e)
if (!(e.KeyData == Keys.Back || e.KeyData == Keys.Delete))
if (numericUpDown1.Text.Length >= 3 || e.KeyValue == 109)
e.SuppressKeyPress = true;
e.Handled = true;
I hope it resolve your problem. Please marked as answer if it will resolve your problem.

Don't want to miss updates? Please click the below button!

Follow MindStick