Ticket Q94851
Visible to All Users

Telephone number mask

created 17 years ago

I have a TextEdit control that I use on a form to allow the user to enter a phone #. What I'd like to allow to be entered therein is:
(413) 555-1212
555-1212
So, the initial area code section is optinoal. How could I "mask" this? Should I use a different control to accomplish this? If so, which one and how do I use it (i.e. set properties, etc.)?
Lastly, what if I wanted to allow yet another option: 413-555-1212? How would that change the "mask"?

Show previous comments (2)
Dennis Garavsky (DevExpress) 17 years ago

    Hi Bob,
    We are always glad to help you.
    Thanks
    Dennis

      One other related question. When I enter part of the phone #, and try to tab off of the control, a little red x-circle appears, and I'm not allowed to move off the field. This isn't necessarily bad. However, when I try to click on Cancel button of the form, to abandon all edits, I can't. How can I get past this without having to blank out the phone # control, or finishing entry of a phone #? What properties do I have to set, or code do I have to write, to accomplish this?

      Dennis Garavsky (DevExpress) 17 years ago

        Hi Bob,
        Just set the CausesValidation property of the Cancel button to false, to allow closing the form.
        Thanks
        Dennis

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.