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

I have an DatagridViewTextbox Column inside DataGridView1.

I want to accept a textbox value like
6.11
06.11
11.11
.11

means max length should be 5.
ie 2 digits after dot.
and also it should start with dot or a number.

Advance thanks to you.

Regards,
Pawan.
Posted
Updated 14-Jul-10 17:49pm
v2

Use Regex for the same. On textchange or similar event you can verify the value entered using a Regular Expression and act accordingly.
 
Share this answer
 
Comments
Nish Nishant 14-Jul-10 11:01am    
Reason for my vote of 5
Good reply/suggestion.
Any reason why you can't use MaskedTextBox?

MSDN Documentation[^]

Cheers.
 
Share this answer
 
Comments
Pawan Kiran 14-Jul-10 9:44am    
I want to validate a textbox which is inside the gridview.
i tried with maskedtextbox but it is not accepting inside the gridview(means validation is not working)..
That'y i shifted to use textbox
Nish Nishant 14-Jul-10 11:01am    
Reason for my vote of 5
5 worthy suggestion!
TheyCallMeMrJames 14-Jul-10 22:25pm    
Thanks, Pawan...you should update your question to reflect that you're working inside a grid. Cheers.
Pawan Kiran 15-Jul-10 2:02am    
Thank u james, i updated the posted question.

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