Solved

Conditions

Posted on 2012-03-24
4
281 Views
Last Modified: 2012-03-24
How to limit the character of a TextBox?

private void mds_Click(object sender, RoutedEventArgs e)
{
   If (iText.Text Character?? >= 12 character)
   {
       MessageBos.Show("Wrong Entry");
   }
   
}
0
Comment
Question by:Whing Dela Cruz
4 Comments
 
LVL 2

Assisted Solution

by:JAruchamy
JAruchamy earned 250 total points
ID: 37762083
0
 
LVL 14

Accepted Solution

by:
nishant joshi earned 250 total points
ID: 37762108
private void mds_Click(object sender, RoutedEventArgs e)
{
   If (iText.Text.Length() >= 12 character)
   {
       MessageBox.Show("Wrong Entry");
   }
    
}

Open in new window


Regards,
nishant
0
 
LVL 15

Expert Comment

by:navneethegde
ID: 37762137
Hi!

You can set MaxLength propery of textbox
<TextBox MaxLength="12 />


Thanks!
0
 

Author Closing Comment

by:Whing Dela Cruz
ID: 37762140
Thanks!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question