Home All Groups Group Topic Archive Search About

Help Clearing data in MaskEditBox Control

Author
13 Sep 2006 3:16 AM
jamesburkett
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.

Author
13 Sep 2006 3:54 AM
rowe_newsgroups
I don't think you need to clear the mask, you should be able to just
use
mskName.Text = ""

Thanks,

Seth Rowe

jamesburk***@gmail.com wrote:
Show quoteHide quote
> 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.
Author
13 Sep 2006 4:13 AM
James
Yeah, that didn't work either... actually... on all of my masked edit
boxes, it isn't recognizing the .text property as anything other than
"". Any ideas there? Thanks!
rowe_newsgroups wrote:
Show quoteHide quote
> I don't think you need to clear the mask, you should be able to just
> use
> mskName.Text = ""
>
> Thanks,
>
> Seth Rowe
>
> jamesburk***@gmail.com wrote:
> > 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.
Author
13 Sep 2006 11:05 AM
rowe_newsgroups
Does it throw an error when you try to set the .Text property? Also,
have you tried stepping through the code to make sure that nothing is
interfering?

Thanks,

Seth

James wrote:
Show quoteHide quote
> Yeah, that didn't work either... actually... on all of my masked edit
> boxes, it isn't recognizing the .text property as anything other than
> "". Any ideas there? Thanks!
> rowe_newsgroups wrote:
> > I don't think you need to clear the mask, you should be able to just
> > use
> > mskName.Text = ""
> >
> > Thanks,
> >
> > Seth Rowe
> >
> > jamesburk***@gmail.com wrote:
> > > 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.
Author
13 Sep 2006 11:49 AM
James
I've stepped through about 15 times.... I can't figure it out, but I'm
gonna go into my professor today. Tahnks for the help though.


rowe_newsgroups wrote:
Show quoteHide quote
> Does it throw an error when you try to set the .Text property? Also,
> have you tried stepping through the code to make sure that nothing is
> interfering?
>
> Thanks,
>
> Seth
>
> James wrote:
> > Yeah, that didn't work either... actually... on all of my masked edit
> > boxes, it isn't recognizing the .text property as anything other than
> > "". Any ideas there? Thanks!
> > rowe_newsgroups wrote:
> > > I don't think you need to clear the mask, you should be able to just
> > > use
> > > mskName.Text = ""
> > >
> > > Thanks,
> > >
> > > Seth Rowe
> > >
> > > jamesburk***@gmail.com wrote:
> > > > 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.
Author
13 Sep 2006 12:13 PM
rowe_newsgroups
Let me know what you find out, it's got me curious.

Thanks,

Seth

James wrote:
Show quoteHide quote
> I've stepped through about 15 times.... I can't figure it out, but I'm
> gonna go into my professor today. Tahnks for the help though.
>
>
> rowe_newsgroups wrote:
> > Does it throw an error when you try to set the .Text property? Also,
> > have you tried stepping through the code to make sure that nothing is
> > interfering?
> >
> > Thanks,
> >
> > Seth
> >
> > James wrote:
> > > Yeah, that didn't work either... actually... on all of my masked edit
> > > boxes, it isn't recognizing the .text property as anything other than
> > > "". Any ideas there? Thanks!
> > > rowe_newsgroups wrote:
> > > > I don't think you need to clear the mask, you should be able to just
> > > > use
> > > > mskName.Text = ""
> > > >
> > > > Thanks,
> > > >
> > > > Seth Rowe
> > > >
> > > > jamesburk***@gmail.com wrote:
> > > > > 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.
Author
14 Sep 2006 1:39 AM
James
ok, i've got an update....

to clear the mskeditbox you have to:
mskName.Mask = " "
'there must be a space
mskName.Text = " "
mskName.Mask = "#####"

but it's weird because it still doesn't register the mask.text to have
anything in it.... anyone have any ideas? Thanks.

rowe_newsgroups wrote:
Show quoteHide quote
> Let me know what you find out, it's got me curious.
>
> Thanks,
>
> Seth
>
> James wrote:
> > I've stepped through about 15 times.... I can't figure it out, but I'm
> > gonna go into my professor today. Tahnks for the help though.
> >
> >
> > rowe_newsgroups wrote:
> > > Does it throw an error when you try to set the .Text property? Also,
> > > have you tried stepping through the code to make sure that nothing is
> > > interfering?
> > >
> > > Thanks,
> > >
> > > Seth
> > >
> > > James wrote:
> > > > Yeah, that didn't work either... actually... on all of my masked edit
> > > > boxes, it isn't recognizing the .text property as anything other than
> > > > "". Any ideas there? Thanks!
> > > > rowe_newsgroups wrote:
> > > > > I don't think you need to clear the mask, you should be able to just
> > > > > use
> > > > > mskName.Text = ""
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Seth Rowe
> > > > >
> > > > > jamesburk***@gmail.com wrote:
> > > > > > 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.
Author
14 Sep 2006 2:17 AM
James
and I figured the rest out... ok

the .text property is not recognized by the mskeditbox so you must use
the .seltext but you must follow this format:

mskZip.SelStart = 0
mskZip.SelLength = Len(mskZip.Mask)
strZip = mskZip.SelText

James wrote:
Show quoteHide quote
> ok, i've got an update....
>
> to clear the mskeditbox you have to:
> mskName.Mask = " "
> 'there must be a space
> mskName.Text = " "
> mskName.Mask = "#####"
>
> but it's weird because it still doesn't register the mask.text to have
> anything in it.... anyone have any ideas? Thanks.
>
> rowe_newsgroups wrote:
> > Let me know what you find out, it's got me curious.
> >
> > Thanks,
> >
> > Seth
> >
> > James wrote:
> > > I've stepped through about 15 times.... I can't figure it out, but I'm
> > > gonna go into my professor today. Tahnks for the help though.
> > >
> > >
> > > rowe_newsgroups wrote:
> > > > Does it throw an error when you try to set the .Text property? Also,
> > > > have you tried stepping through the code to make sure that nothing is
> > > > interfering?
> > > >
> > > > Thanks,
> > > >
> > > > Seth
> > > >
> > > > James wrote:
> > > > > Yeah, that didn't work either... actually... on all of my masked edit
> > > > > boxes, it isn't recognizing the .text property as anything other than
> > > > > "". Any ideas there? Thanks!
> > > > > rowe_newsgroups wrote:
> > > > > > I don't think you need to clear the mask, you should be able to just
> > > > > > use
> > > > > > mskName.Text = ""
> > > > > >
> > > > > > Thanks,
> > > > > >
> > > > > > Seth Rowe
> > > > > >
> > > > > > jamesburk***@gmail.com wrote:
> > > > > > > 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.
Author
14 Sep 2006 2:25 AM
Jim Wooley
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