使用正则表达式:
using System.Text.RegularExpressions;

string pattern = @^/d+(/./d)?$;
if(Text1.Text.Trim()!=)
{
if(!Regex.IsMatch(sign_money.Text.Trim(),pattern))
{
Text1不是数字;
}
else
{
Text1是数字;
}
}
-------------------------------------------------------------------------------------
try
{
double.Parse(this.TextBox1.Text);
Response.Write(是数字);
}
catch
{
Response.Write(不是数字);


 

本文转载:CSDN博客