|
-
Oct 15th, 2001, 07:46 PM
#1
Thread Starter
Fanatic Member
Using MaskEdBox
In MaskEdBox, I have the following code:
Code:
medDOB.Mask = "##/##/##"
medDOB.Text = Format(rstPlayer!sgcusbdate, "ddddd")
Now if the date part is less than 10, then it display only 1 integer, but the Mask expect 2 integer. So error occur.
How can I make sure that the datepart is always 2 integers? (Note: I must use dateformat "ddddd" ie. vbshortdate since this is an international app.)
Thanks.
-
Oct 15th, 2001, 10:30 PM
#2
PowerPoster
Since you like using controls
Why not use a DTpicker? It will always give you a valid date...
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Oct 16th, 2001, 01:49 AM
#3
Well ...
Originally posted by TheBao
In MaskEdBox, I have the following code:
Code:
medDOB.Mask = "##/##/##"
medDOB.Text = Format(rstPlayer!sgcusbdate, "ddddd")
Now if the date part is less than 10, then it display only 1 integer, but the Mask expect 2 integer. So error occur.
How can I make sure that the datepart is always 2 integers? (Note: I must use dateformat "ddddd" ie. vbshortdate since this is an international app.)
Thanks.
Here is how I use a MaskEdBox in code:
VB Code:
Dim tmpMask As String
tmpMask = MaskEdBox1.Mask
MaskEdBox1.Mask = ""
MaskEdBox1.Text = <Some value goes here>
MaskEdBox1.Mask = tmpMask
To put it simply, you extract the existing mask into a temporary variable, remove the mask, then set the text and reset the mask using the temporary variable. I am sure this will do the trick for you.
.
-
Oct 16th, 2001, 04:20 PM
#4
Thread Starter
Fanatic Member
Thank you. Actually, what I want is more than that.
I don't know before hand what the format of the date on the user machine is. So I end up have to get this from the regional setting, then convert this to the mask string for the MaskEdBox.
Thanks.
-
Oct 17th, 2001, 02:27 AM
#5
Well ...
Can you retrieve the format from the regional settings? Converting it to a Mask value is your problem? Or once the mask is set, displaying data in that format is a problem?
I guess you can use the "Short Date" in the Format() function to format the date as per the user's regional settings. If the problem is the second one, I can help.
.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|