Solved

Conditions

Posted on 2012-03-24
4
282 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

726 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