请帮我解决IsNumeric错误 [英] Please help me solve IsNumeric error
本文介绍了请帮我解决IsNumeric错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码。 System.convert不包含IsNumeric的定义。然后应该怎么做。请帮我解决这个错误。
if((string.IsNullOrEmpty(Request [" form_next_lesson_hours"]))|(转换.IsNumeric(请求[" form_next_lesson_hours"])))
错误+ ="< br>请输入下一课时长(通常为\1.5 \小时) ;
解决方案
IsNumeric
只是VB.NET中的一个函数。在C#中,您可以使用double.TryParse
来检查输入是否为数字,如果是,则此方法返回true并将转换后的值存储在变量中。 br />
double d;
bool isNumeric = double .TryParse(Request [ form_next_lesson_hours], out d);
Here is my code. System.convert doesnot contain a defination forIsNumeric. Then what should iuse. Please help me solve this error.
if ((string.IsNullOrEmpty(Request["form_next_lesson_hours"])) | (Convert.IsNumeric(Request["form_next_lesson_hours"])))
errors += "<br>Please enter a next-lesson duration (typically \"1.5\" hours);
解决方案
IsNumeric
is only a function in VB.NET. In C#, you can usedouble.TryParse
to check whether the input is numeric, and if it is, this method returns true and it stores the converted value in a variable.
double d; bool isNumeric = double.TryParse(Request["form_next_lesson_hours"], out d);
这篇关于请帮我解决IsNumeric错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文