|
-
Oct 2nd, 2000, 11:56 AM
#1
Thread Starter
Frenzied Member
Hi,
I have a text box that I only want a date entered in to. But, what else I would like to do is as the user is typing, the / signs automatically get placed after the month and year..
It's just kindof a nice feature to have and I have seen it done before.. Access seems to have this built in but I can't figure it out in VB6.
I understand that there might be a control that does this, but would rather do it in code so I don't have to distribute another control..
Thanks,
Dan
-
Oct 2nd, 2000, 11:59 AM
#2
Thread Starter
Frenzied Member
In thinking about my question some more, forget about automatically entering the / signs.. I guess it's not like a phone number where it is a fixed number of digits..
But, what I would like is some code that checks to make sure the user entered a valid date and if not, pop up a msgbox..
Thanks,
DAn
-
Oct 2nd, 2000, 12:10 PM
#3
Frenzied Member
Code:
Private Sub Text1_LostFocus()
'IsDate checks if the expression is a valid date
If IsDate(text1.text) = False Then
MsgBox "Please enter a valid date
End if
End sub
'>>>USAGE<<<
'IsDate("hahaha") = False
'IsDate(22-22-00) = False
'IsDate(021000) = False
'IsDate("02.10.00") = True
'IsDate(02-10-00) = True
'IsDate(02/10/00) = True
[Edited by Jop on 10-02-2000 at 01:13 PM]
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Oct 2nd, 2000, 01:46 PM
#4
_______
<?>
Replace the textbox with a MaskEdBox
Set the MaskedBox Mask property to ####/##/##
Include literals
then nothing but nambers can be entered and the
box will read yyyy/mm/dd
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
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
|