Accepting a rejected character in a Masked Textbox
-
Hi, I'm trying to figure out how to accept a rejected character in a masked text box. I am using a "Masked Textbox" for the person's last name and to ensure all alpha characters, I'm using "L?????????????????", however if the person's last name has a quote in it, the masked text box is rejecting it but in code I want to accept it. I see I can where I can check the character in the Reject event, however I can not cancel the reject. Any suggestions how to do this, other than using a Keydown event and accepting only the characters I want? Thank you,
Glenn
-
Hi, I'm trying to figure out how to accept a rejected character in a masked text box. I am using a "Masked Textbox" for the person's last name and to ensure all alpha characters, I'm using "L?????????????????", however if the person's last name has a quote in it, the masked text box is rejecting it but in code I want to accept it. I see I can where I can check the character in the Reject event, however I can not cancel the reject. Any suggestions how to do this, other than using a Keydown event and accepting only the characters I want? Thank you,
Glenn
If you want to allow single quote or double quote then use C instead of ?. It will allow any printable character. http://msdn.microsoft.com/en-us/library/system.windows.forms.maskedtextbox.mask.aspx[^] Otherwise, you need to do validation/restriction on last name manually. Either by tracking lost focus event or likewise.. Hope this will help!
Jinal Desai - LIVE Experience is mother of sage....