- Back to Home »
- Windows Applications »
- MaskedTextBox
Posted by :
Sudhir Chekuri
Monday, 15 February 2016
Used to take user inputs based on the given condition.
To set the condition for Masked textbox:
Click on smart tag – Select SetMask
You can select available predefined masking conditions or can write our own condtions.
Example: 000000000 for 10 digit numbers
Default event: MaskInputRejected which is fired when user entered an invalid input in masked textbox.
To set the condition for Masked textbox:
Click on smart tag – Select SetMask
You can select available predefined masking conditions or can write our own condtions.
Example: 000000000 for 10 digit numbers
Default event: MaskInputRejected which is fired when user entered an invalid input in masked textbox.
Example
code to clear text in masked textbox everytime when user enter invalid text:
private void maskedTextBox1_MaskInputRejected(object sender, MaskInputRejectedEventArgs e)
{
maskedTextBox1.Text = "";
}