I need to find out what value the user has entered into a textbox.
The user could've entered an integer, double or decimal number into the textbox.
Which one should I use to validate the value?
Double.Parse(txtboxNo.text)
int.Parse(txtboxNo.text);
Decimal.Parse(txtboxNo.text)
I tried this (if user enter 1 or 1.8, this function still work):
public bool IsNumeric(string strNbr)
{
Double d_Nbr;
try
{
d_Nbr = Double.Parse(strNbr);
return true;
}
catch (Exception ex)
{
return false;
}
}
My problem: I am working on a mobile Sales App. The sales man has the rights to change the price. Salesman want to work fast. So, I need to detect if he enter a correct price ( my price is decimal) what if he enter : example: 1 or 1.0 or 23 or 333.0 or press for fun 123456 . How I handle ?