C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Skip validation for calculated values displayed in a textbox


Posted Date: 05 Mar 2007    Resource Type: Code Snippets    Category: Validations

Posted By: Balamurali Balaji       Member Level: Diamond
Rating:     Points: 10



If a textbox is assigned to a calculated value that violates an existing validating condition, you could still provide an option to surpass the validation, not messing up too much with the code.





// The following is a validation condition that prevents users to enter more than 3 characters
private void textBox1_Validating(object sender, CancelEventArgs e)
{
if (textBox1.Text.Length > 3)
{ MessageBox.Show("Length exceeds 3 characters");
e.Cancel = true;
}
}





// You can surpass the above validation condition on assigning a calculated value for textBox1.

textBox1.Enabled = false;
this.ValidateChildren(ValidationConstraints.Enabled);
textBox1.Text = "abcd" + "1234";







Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Checkbox validation - Enforce atleast one checkbox checked
Previous Resource: Detect Weekend in JavaScript and Confirm
Return to Discussion Resource Index
Post New Resource
Category: Validations


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

silicone halloween masks

Contact Us    Privacy Policy    Terms Of Use