Click here to Skip to main content
15,907,149 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to set validatior on a text box which not contain data more then 140 letors with white space
Posted

This regular expression will do...
[s\S]{0,140}
 
Share this answer
 
TextBox has a property called MaxLength.
Set the value of this property to 140 and you are done.
 
Share this answer
 
Comments
aswathy.s.88 10-Sep-10 1:07am    
But in case of multiline enabled MaxLength property does'nt work.
Ankur\m/ 10-Sep-10 1:16am    
You didn't mention that before.
Oh wait.. Is it a windows application or a web application?
In case of web application, you can use simple Javascript to implement this or may use regular expression as well.
Here is a quick Google search link: http://www.google.com/#hl=en&source=hp&q=maxlength+multiline+textbox&aq=4&aqi=g10&aql=&oq=maxlength+&gs_rfai=&fp=57aa981c9ca75b88

Hope this helps!
aswathy.s.88 10-Sep-10 1:24am    
Can't copy this link....
Better using regular expression...
Ankur\m/ 10-Sep-10 1:27am    
Why can't you copy the link? You may alternatively search for "maxlength multiline textbox".
And I just noticed, are you using 2 id's. The question was asked by VinodKumar01 and the comments by aswathy.s.88
aswathy.s.88 10-Sep-10 7:10am    
No ya!Quesion was asked by Vinod and when I saw ur answer just left a comment.

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