Results 1 to 4 of 4

Thread: How to clear a MaskedBox?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Posts
    1,384

    How to clear a MaskedBox?

    I have a MaskedBox masked as ##/##/##, but I want to clear it after I use it. I've tried:
    mBox.Text = ""
    mBox = " / / "
    mBox = "--/--/--"
    mBox.Clear

    But all result in errors
    Mel

  2. #2
    Member
    Join Date
    Sep 2002
    Location
    Brisbane, Australia
    Posts
    32
    try this in order

    VB Code:
    1. mBox.Mask = ""
    2. mBox.Text = ""
    3. mBox.Mask = "--/--/--"

  3. #3
    Addicted Member
    Join Date
    Sep 2002
    Posts
    137

    Re: How to clear a MaskedBox?

    this is the code I use for both mask and text boxs


    For X = 0 To Me.Controls.Count - 1
    If (TypeOf Me.Controls(X) Is TextBox) Then Me.Controls(X).Text = "" Else Me.Controls(X).Text = "###-###-###"
    Me.Controls(X).Enabled = False
    End If
    Next X







    Originally posted by mel_flynn
    I have a MaskedBox masked as ##/##/##, but I want to clear it after I use it. I've tried:
    mBox.Text = ""
    mBox = " / / "
    mBox = "--/--/--"
    mBox.Clear

    But all result in errors

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Posts
    1,384
    Nice one, thanks.
    Code:
    mBox.Mask = ""
    mBox.Text = ""
    mBox.Mask = "##/##/##"
    Mel

Posting Permissions

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



Click Here to Expand Forum to Full Width