How to check if a string is Numeric in .Net c#

You will need to validate if user’s input is numeric especially on billing system where money is involved. If you are using .Net framework 2.0, try the following code sample.

public static bool IsNumberic(string val)
{
      Int32 qty;
      return Int32.TryParse(val, out qty);
}
Advertisements