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

    Unanswered: Can't clear masked edit control

    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)

    Any ideas?


    Thanks
    SteveH

  2. #2
    Join Date
    Dec 2002
    Posts
    11
    You need to set the text to null and you don't need to specify the "text" property since it is the default property. The following worked for me when I tried it:

    Private Sub Form_Open(Cancel As Integer)
    MaskEdBox0 = ""
    MaskEdBox0.Mask = "##/##/####"
    End Sub

  3. #3
    Join Date
    Apr 2002
    Location
    Illinois
    Posts
    133

    Didn't work for me

    Ixalmida,

    Thanks for the reply. For some reason it didn't work for me. I got an error during compile.
    SteveH

  4. #4
    Join Date
    Dec 2002
    Posts
    11

    Re: Didn't work for me

    Hmm...maybe it is a version thing. I was only able to try it in VB5. Then again, you may just have a corrupted component. Who knows?

  5. #5
    Join Date
    Apr 2002
    Location
    Illinois
    Posts
    133

    Version Thing

    You may have a point. I should have mentioned I am using VB.Net.
    SteveH

Posting Permissions

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