|
-
Apr 28th, 2001, 03:14 PM
#1
System Date compared against a string
Hi
Back again! (great site - very helpful)
Is it possible to compare the system date with a written date?
I've shown the current date by:
Label1.caption = date
I've a list box which has several dates which the user clicks
on to obtain information for that particular date. These dates I've displayed by just putting them in quotes i.e. "10th April 2001".
Can I check these dates against the system date and disable the choice should the date have passed?
Any help gratefully received
TKS
Ben
-
Apr 28th, 2001, 03:19 PM
#2
Hyperactive Member
you could try this
Code:
Listbox_Change()
If listbox.text >= Date then
'Enter Code Here
End If
Last edited by Lee M.; Apr 28th, 2001 at 03:49 PM.
 Mahalo 
VB6(SP5), VC++, COBOL, Basic, JAVA
MBA, MCSD, MCSE, A+
Computer Forensics
-
Apr 28th, 2001, 08:02 PM
#3
Actually, this is how it should be:
Code:
Listbox_Change()
If CDate(listbox.text) >= Date then
'Enter Code Here
End If
for example, if you type these two lines:
MsgBox CDate("30 April 2001") < Date
MsgBox "30 April 2001" < Date
...the first message box will say False and the second one will say True. (Assuming April 30, 2001 didn't come yet)
Also, the way you're typing the date may have to be changed. If you type the date as "10th April 2001", the above code will give an error. If you type it as "10 April 2001", it'll be fine. (at least that's how it is on my computer)
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
|