Validation on NumericUpDown Control in C#.Net

Total Post:134


 5329  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!
  1. Re: Validation on NumericUpDown Control in C#.Net

    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.


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.