Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Invalid date with textbox
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00781308
Message ID:
00781542
Views:
13
>Thanks for your reply Randy. I neglected to check out the physical books because that would require me to get off the chair <s>. I will have to dig out the book now cuz you made me curious. (download the dook in pdf format you might say and I will answer yes I should do that some day lol)
>
>I acctually was able to solve the problem by converting the type from date to character do my own simple date validation (empty(ctod(lcMyDate))) and then convert the character date to a date type if it was a valid date. I am very happy with my solution.
>
>Thanks for replying everybody.
>
>Einar
>
>>Hello Einar,
>>
>>I've read all the other responses and see that you don't have a solution yet. In my Hackers Guide (Hacker's Guide® to Visual FoxPro 6.0™, Copyright © 1998 by Tamar E. Granor and Ted Roche. All rights reserved.) under the subject ON READERROR, the authors quote that obscure command as being the only solution to the Invalid Date challenge.
>>
>>Check out your copy. HTH,

I was playing, this might get you started
oFrm = CREATEOBJECT("cForm")
oFrm.Show(1)

DEFINE CLASS DATEBOX AS TextBox

dOrig = DATE()
Value = DATE()

PROCEDURE GOTFOCUS

This.dOrig = This.Value
ON readerror _Screen.ActiveForm.ActiveControl.InvalidDate()

ENDPROC

PROCEDURE LOSTFOCUS

ON READERROR

ENDPROC

PROCEDURE InvalidDate

This.Value = This.dOrig
WAIT WINDOW NOWAIT "The entered date was invalid" 

ENDPROC

ENDDEFINE

DEFINE CLASS cForm AS Form

ADD OBJECT txtDate AS DATEBOX

ENDDEFINE
Tracy
Previous
Reply
Map
View

Click here to load this message in the networking platform