Go Back   Forum Care Forums > Development Reference Area > Visual Basic

Reply
 
LinkBack Thread Tools Display Modes
Masked edit box
Old
  (#1)
Eric Kiernan
Guest
 
Posts: n/a
Default Masked edit box - 06-04-2007, 09:49 AM

I have a masked edit box which has a value of "8/30/2004", and when i
programically set the value to mskedbox1=date, the vb blows up with an
invalid property value error. any ideas? It works ok if i set
mskedbox1="08/30/2004", but I can't seem to get the date value into the box.
I've even tried using format(date,"Short Date") to no avail. Format and
mask properties of the box are set to ##/##/####


   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: Masked edit box
Old
  (#2)
Rick Rothstein
Guest
 
Posts: n/a
Default Re: Masked edit box - 06-04-2007, 09:49 AM

> I have a masked edit box which has a value of "8/30/2004", and when i
> programically set the value to mskedbox1=date, the vb blows up with an
> invalid property value error. any ideas? It works ok if i set
> mskedbox1="08/30/2004", but I can't seem to get the date value into

the box.
> I've even tried using format(date,"Short Date") to no avail. Format

and
> mask properties of the box are set to ##/##/####


Don't set the Format property (only set the Mask property) and ***ign
the Date this way...

mskedbox1.Text = Format$(Date, "mm/dd/yyyy")

Note that I specify the Text property rather than ***ume VB will apply
it as the default property. Do so will make reading your code much
easier six months to a year from now when you (or, if you are working in
a company, the person ***igned to the task) have to modify your code. As
for the form of the Format function's specification string... it much
match the format of the Mask property character for character (that
means leading zeroes must be preserved).

Rick - MVP

   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: Masked edit box
Old
  (#3)
Eric Kiernan
Guest
 
Posts: n/a
Default Re: Masked edit box - 06-04-2007, 09:49 AM

Thanks. That worked.

"Rick Rothstein" <EMAIL REMOVED> wrote in message
news:2ZGdneb0VeAEBazcRVn-EMAIL REMOVED...
> > I have a masked edit box which has a value of "8/30/2004", and when i
> > programically set the value to mskedbox1=date, the vb blows up with an
> > invalid property value error. any ideas? It works ok if i set
> > mskedbox1="08/30/2004", but I can't seem to get the date value into

> the box.
> > I've even tried using format(date,"Short Date") to no avail. Format

> and
> > mask properties of the box are set to ##/##/####

>
> Don't set the Format property (only set the Mask property) and ***ign
> the Date this way...
>
> mskedbox1.Text = Format$(Date, "mm/dd/yyyy")
>
> Note that I specify the Text property rather than ***ume VB will apply
> it as the default property. Do so will make reading your code much
> easier six months to a year from now when you (or, if you are working in
> a company, the person ***igned to the task) have to modify your code. As
> for the form of the Format function's specification string... it much
> match the format of the Mask property character for character (that
> means leading zeroes must be preserved).
>
> Rick - MVP
>



   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Contact Us - Forum Care Forums - Archive - Top