Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need a way to validate a date.
Message
From
17/10/2002 12:14:19
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00712402
Message ID:
00712408
Views:
8
John,

You can get it to show "Invalid Date" by SET NOTIFY ON in gotfocus().

But I'm not a big fan of that either. The following will help if the user keyboards out of the field (you can add a check for up-arrow). But I don't know how to trap someone trying to mouse out...
* keypress() method
LPARAMETERS nKeyCode, nShiftAltCtrl

if nKeyCode = 13 or nKeyCode = 9
	if empty(this.value)
		* date is invalid
                nodefault  && you may or may not want this...espec. if SET NOTIFY IS ON
	endif
endif
>Hi all,
>I just got a nasty call from a customer that spent an hour trying to run a report from Sep. 1 through Sep. 31. Rebooted the computer several times and all that.
>
>I have a custom text box class that I use to get dates. It works wonderfully and brings up a calendar if the user double clicks on the text box. The problem is I can't find a way to valdiate the date if the user just types it in. If the user enters an invalid date the cursor just stays in the text box. On error does nothing here as one would expect but the normal wait window invalid date also does not show, not that I'm a big fan of that anyway. How can I trap for an invalid date? I would like to be able to display a message box or bring up the calendar but I can find no way to trigger it.
>
>Thanks in advance,
>John.
Steve Gibson
Previous
Reply
Map
View

Click here to load this message in the networking platform