Click here to Skip to main content
15,892,480 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have an textbox which accepts the following values:

1.5--->valid
1.0-->valid
12.5-->valid
12-->valid
12.0-->valid
1111->valid

When the entire text box which contains any only numeric values without a decimal point is selected,am able to edit.

But the problem is when the text box containing any of the above mentioned decimal combination is selected, and trying to edit... am not able to edit..

What could be the reason for this?

am using two regular expressions:

Regex expressionToValidate_Is_Numeric_Or_Not = new Regex("[^[0-9.]+");
Regex expressionToValidate_String_Structure = new Regex(^[\\d{1,2}([.]\\d{1})]);



please provide me a solution in C#
Posted

use this for decimal :
^[0-9]+\.[0-9]{,1}$
or u can use decimal.TryParse()
 
Share this answer
 
Comments
Member 10593922 12-Mar-14 3:31am    
thank u for the reply.. can u please give a sample how to write the above expression using decimal.try parse
i don't understand your question, please explain more about your problem.
 
Share this answer
 
Comments
Member 10593922 12-Mar-14 3:04am    
Am not able to edit the textbox on selection of the text containing numeric and decimal values in the text box
Sergey Alexandrovich Kryukov 13-Jun-14 1:56am    
How could you post this as a "solution"? Use comments instead.
—SA

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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