Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2002
    Location
    Illinois
    Posts
    133

    Unanswered: Can't clear masked edit control - VB.Net

    I posted this in the VB forum but haven't gotten an answer that works yet. I hope I fine a VB.Net person here.

    I have an unbound masked edit control with a mask for a social security number. I had code in the click event of a button to clear the SSN but it would only work the first time the button was clicked.

    This is the line of code I used:

    Me.MaskedEdit1.Text = " / / " (3 spaces, 2 spaces, 4 spaces)

    Also tried:
    Me.MaskedEdit1.Text = " / / " (same spaces)
    Me.MaskedEdit1.Mask = "###/##/####"

    And:
    Me.MaskedEdit1.Mask = "###/##/####"
    Me.MaskedEdit1.Text = " / / " (same spaces)

    And:
    Me.MaskedEdit1.Text = ""
    Me.MaskedEdit1.Mask = "###/##/####"

    Any ideas?


    Thanks
    SteveH

  2. #2
    Join Date
    Jun 2004
    Posts
    1

    Cool

    Hey Steve,

    I have the same problem with a masked Edit Control for entering a phone number. I have been frantically searching for a fix, but I could not find one. I came up with a workaround.

    I set the .Mask = " "
    then the .SelText = " "
    then reset the .Mask = "(###)###-####"
    here is my code

    mskPhone is the name of the Masked Edit TextBox

    mskPhone.Mask = " "
    mskPhone.SelText = " "
    mskPhone.Mask = "(###)###-####"


    I hope this helps
    Thanks,
    Kristyn

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •