Click here to Skip to main content
16,020,673 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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);
Posted

1 solution

IsNumeric is only a function in VB.NET. In C#, you can use double.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.
C#
double d;
bool isNumeric = double.TryParse(Request["form_next_lesson_hours"], out d);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900