3
Answers

How to allow numbers and decimal points ?

Raja

Raja

8y
216
1
if (!int.TryParse(ds.Tables[s].Rows[i][Columncountvalue + 10].ToString().Trim(), out parsedValue))  
{
//statement
}
I have used above code for restrict enter letters in data table columns.now i want to allow decimal points and numbers in data table (100, 102.25)
How to do it.
Answers (3)
1
Nitin Sontakke

Nitin Sontakke

NA 11.7k 2.2k 8y
You have used int.TryParse, similarly just use double.TryParse. That's all you have to do.
Accepted
2
ketan borsdiya

ketan borsdiya

NA 1.5k 3k 8y
Hi Raja,
Use below code snippet for your problem,
var regex = new Regex(@"^[0-9]*(?:\.[0-9]*)?$");
if (regex.IsMatch(ds.Tables[s].Rows[i][Columncountvalue + 10].ToString().Trim()))
{
//statement
}
0
Raja

Raja

NA 1.7k 45.2k 8y
Thank you so much