Hello james,
I'm trying to clear text from a MaskEditBox control.
I thought the format to delete it was:
'clear the mask
mskName.Mask = ""
'clear the text
mskName.Text = ""
'reassign the mask
mskName.Mask = "##:## ??"
this doesn't seem to work... what am I doing wrong? Thanks.
Since you are refering to the MaskEditBox, I assume you are working with
VB6 as the 2005 version is the MaskedTextBox. If it is the VB6 version, you
may want to try one of the VB6 groups. FWIW, here's the code I used on my
wrapped box:
Public Property Let Text(ByVal New_Text As Variant)
Dim stMask As String
'clear out old value
mflgLoading = True
stMask = MaskEdBox1.Mask
MaskEdBox1.Mask = ""
MaskEdBox1.Text = ""
MaskEdBox1.Mask = stMask
'put data in box
If IsNull(New_Text) = False Then
Select Case stMask
Case "##/##/####", "&&/&&/&&&&"
MaskEdBox1.SelText = Format(New_Text, "mm/dd/yyyy")
Case Else
MaskEdBox1.SelText = New_Text
End Select
End If
PropertyChanged "Text"
mflgLoading = False
RaiseEvent Change
End Property
My full sample is available at
http://avbsg.net/Uploads/JW071801.exe. (note,
this is actually a zip file not exe. You will need to change the extension
in order for it to extract properly).
Jim Wooley
http://devauthority.com/blogs/jwooley/default.aspx