---
title: "Validation on NumericUpDown Control in C#.Net"  
description: "Validation on NumericUpDown Control in C#.Net"  
author: "Anonymous User"  
published: 2012-09-06  
updated: 2012-09-08  
canonical: https://www.mindstick.com/forum/442/validation-on-numericupdown-control-in-c-sharp-dot-net  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Validation on NumericUpDown Control in C#.Net

Hello Everyone,\
I'm working with [NumericUpDown](https://www.mindstick.com/forum/1899/scroll-in-numericupdown) [Control](https://www.mindstick.com/blog/197/asp-dot-net-repeater-control) in [C#.Net](https://www.mindstick.com/forum/150/how-to-check-a-uploaded-file-type-using-asp-dot-net-with-c-sharp-dot-net) and I want to [user input](https://www.mindstick.com/forum/159624/setting-an-enum-from-user-input) [limit](https://www.mindstick.com/forum/159824/explain-the-purpose-of-the-limit-and-offset-clauses-and-how-are-they-used-for-pagination) [validation](https://www.mindstick.com/articles/12234/validation-using-data-annotation-using-entity-framework) 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](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) too. \
\
Thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)!

## Replies

### Reply by Anonymous User

Hi Tanuj, \
You can use following line of code to validate [user](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server): \

```
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.
```


---

Original Source: https://www.mindstick.com/forum/442/validation-on-numericupdown-control-in-c-sharp-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
