if语句中的局部变量如何用出来
Regex r = new Regex(@"^\d+(\.)?\d*$");
if (r.IsMatch(this.txtPrice.Text))
{
string price = txtPrice.Text; }
else
{
ClientScript.RegisterStartupScript(this.GetType(), "", "<Script>alert('价格不为数字!')</Script>");
}
在同一个类中如何用这个price,编译时提示没有price,如果在外面定义了,在里面的修改又不起作用,怎么办,怎么办,求教