devxlogo

Blanks in the Masked Edit Control

Blanks in the Masked Edit Control

The Microsoft Masked Edit control only allows input that matchesthe mask. Similarly, you can only set the Text property to a stringthat matches the mask. If you have a mask for a phone number thatonly allows numbers (#), you cannot set the text to blanks. Aneasy way to set the text to blank is with this code:

 vTemp = mskPhone.MaskmskPhone.Mask = ""mskPhone.Text = ""mskPhone.Mask = vTemp

Removing the mask allows you to set the text to any appropriatestring. Restore the mask afterwards. I use this code in the validationevent of a data control when adding a new record.

devx-admin

Share the Post: