Clearing Mask Edit box


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Clearing Mask Edit box

  1. #1
    Kelly Guest

    Clearing Mask Edit box


    I have a mask edit box with mask of (###)###-####, and a button to clear the
    mask edit box, but when I do the following code in the button it will not
    clear out the phone in the box, but it will clear out text, if the mask was
    set to ""...
    Any Ideas...

    AxMaskEdBox1.Mask = ""
    AxMaskEdBox1.Text = ""
    AxMaskEdBox1.Mask = "(###)###-####"

    Thanks!
    Kelly Reiff

  2. #2
    Kevin Guest

    Re: Clearing Mask Edit box


    Kelly:

    Instead of setting the mask = "" set it = " "

    example:

    Public Sub ClearTextBoxes(ByVal cntl As Control)
    Dim cntl1 As Control
    For Each cntl In cntl.Controls
    If (TypeOf (cntl) Is TextBox) Then
    CType(cntl, TextBox).Clear()
    ElseIf (TypeOf (cntl) Is AxMSMask.AxMaskEdBox) Then
    CType(cntl, AxMSMask.AxMaskEdBox).Mask = " "
    CType(cntl, AxMSMask.AxMaskEdBox).Text = ""
    If InStr(cntl.Tag, "date") > 0 Then CType _ (cntl,AxMSMask.AxMaskEdBox).Mask
    = "##\/##\/##"
    If InStr(cntl.Tag, "phone") > 0 Then CType _(cntl,AxMSMask.AxMaskEdBox).Mask
    = "\(###\) ###\-####"
    ElseIf (TypeOf (cntl) Is ComboBox) And cntl.Tag <> "Master" Then
    CType(cntl, ComboBox).Text = ""
    CType(cntl, ComboBox).SelectedIndex = -1
    ElseIf (TypeOf (cntl) Is CheckBox) Then
    CType(cntl, CheckBox).Checked = False
    End If
    Next cntl
    End Sub

  3. #3
    Kelly Guest

    Re: Clearing Mask Edit box


    Hey Kevin,
    Thanks this what I was looking for...

    Kelly

    "Kevin" <kswiber@hotmail.com> wrote:
    >
    >Kelly:
    >
    >Instead of setting the mask = "" set it = " "
    >
    >example:
    >
    > Public Sub ClearTextBoxes(ByVal cntl As Control)
    > Dim cntl1 As Control
    > For Each cntl In cntl.Controls
    > If (TypeOf (cntl) Is TextBox) Then
    > CType(cntl, TextBox).Clear()
    > ElseIf (TypeOf (cntl) Is AxMSMask.AxMaskEdBox) Then
    > CType(cntl, AxMSMask.AxMaskEdBox).Mask = " "
    > CType(cntl, AxMSMask.AxMaskEdBox).Text = ""
    > If InStr(cntl.Tag, "date") > 0 Then CType _ (cntl,AxMSMask.AxMaskEdBox).Mask
    >= "##\/##\/##"
    > If InStr(cntl.Tag, "phone") > 0 Then CType _(cntl,AxMSMask.AxMaskEdBox).Mask
    >= "\(###\) ###\-####"
    > ElseIf (TypeOf (cntl) Is ComboBox) And cntl.Tag <> "Master" Then
    > CType(cntl, ComboBox).Text = ""
    > CType(cntl, ComboBox).SelectedIndex = -1
    > ElseIf (TypeOf (cntl) Is CheckBox) Then
    > CType(cntl, CheckBox).Checked = False
    > End If
    > Next cntl
    > End Sub



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center