Click here to Skip to main content
15,670,482 members
Articles / Programming Languages / C#
Posted 23 Sep 2011

Tagged as


1 bookmarked

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

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
23 Sep 2011CPOL
using Microsoft.VisualBasic;// Codebool result = Information.IsNumeric("123");
using Microsoft.VisualBasic;

// Code

bool result = Information.IsNumeric("123");


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

Written By
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

GeneralRe: thank you for that Pin
Aria Wijaya4-Oct-11 16:21
Aria Wijaya4-Oct-11 16:21 
GeneralI dont quite follow pranav95, please elaborate, this is a ps... Pin
Aria Wijaya24-Sep-11 16:47
Aria Wijaya24-Sep-11 16:47 
GeneralRe: Okay. IsNumeric checks if the given string contains only nu... Pin
Anshul R27-Sep-11 16:45
Anshul R27-Sep-11 16:45 

IsNumeric checks if the given string contains only numbers.

We can use this function from Microsoft.VisualBasic.Information

It returns a boolean value on checking if the string is numeric.

So, if you want to check if a string (say text from a textbox) is numeric in the program,


will return true if the text is numeric.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.