GET Command VALID Clause UDF Executed For Each Entry

Last reviewed: July 5, 1995
Article ID: Q92344
The information in this article applies to:
  • Microsoft FoxBASE+ for MS-DOS, version 2.1
  • Microsoft FoxPro for MS-DOS, versions 1.02, 2.0, 2.5, and 2.5a
  • Microsoft FoxPro for Windows, versions 2.5 and 2.5a

SUMMARY

When a GET statement VALID clause contains a user-defined function (UDF), the UDF is executed each time the user leaves the field.

MORE INFORMATION

The following code illustrates that a VALID clause UDF is executed each time the user leaves the field. After creating the two files below, enter DO TEST.PRG at the dot prompt. The code demonstrates that whenever the user presses TAB or ENTER to move to the next GET field, the UDF executes, even when the user does not change the value of the "num2" field from zero.

   * TEST.PRG
   CLEAR
   SET TALK OFF
   STORE 0 TO num1,num2,num3
   @3,10 SAY "NUMBER 1: " GET num1
   @5,10 SAY "NUMBER 2: " GET num2 VALID myudf()
   @7,10 SAY "NUMBER 3: " GET num3
   READ SAVE

   * MYUDF.PRG
   PUBLIC mreturn
   mreturn=.F.
   @15,15 SAY "IN MYUDF()                            "
   IF num2<>0
     @15,26 SAY "AND VALUE CHANGED FROM ZERO"
     mreturn=.T.
   ENDIF
   RETURN mreturn


Additional reference words: FoxWin FoxDos 2.10 2.00 2.50 2.50A 2.x fox base
KBCategory: kbprg
KBSubcategory:FxprgGeneral


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 5, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.