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.

See also  Why ChatGPT Is So Important Today
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist