Click here to Skip to main content
15,892,005 members
Articles / Programming Languages / C#

Validate numeric textbox using int.tryparse visual C#.NET

Rate me:
Please Sign up or sign in to vote.
4.00/5 (1 vote)
2 Oct 2011CPOL 13.9K   2  
You could always run the TryParse on the keyDown event so as to validate as the data gets entered. It saves the user an additional UI interaction. private void textBox1_KeyDown(object sender, KeyEventArgs e) { int i; string s = string.Empty; ...

Views

Daily Counts

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Systems Engineer Stratco
Australia Australia
This member doesn't quite have enough reputation to be able to display their biography and homepage.

Comments and Discussions