110,535
社区成员
发帖
与我相关
我的任务
分享
[Quote=引用 9 楼 pgdoryoku 的回复:]string monval = @"^([1-9]\d+|[0-9])(\.\d\d?)?$";
try{
//
}catch(FormatException){
MessageBox.Show("只能输入数字!");
return;
}
进行异常捕获
char[] number=new char(10){'0','1','2','3','4','5','6','7','8','9','.'};
strng check=textbox1.text.trim(number);
if(check= ="")
{
MessageBox.Show("為數字型");
}
Else
{
Messagebox.show("為字符串");
}
/// <summary>
/// 金额验证
/// </summary>
/// <param name="moneycheck"></param>
/// <returns></returns>
public static bool Money(string moneycheck)
{
string monval = @"^([1-9]\d+|[0-9])(\.\d\d?)*$";
return Regex.IsMatch(moneycheck, monval);
}
#endregion