PRB: Program Error While Using Search in Wizard-Generated Form

Last reviewed: September 10, 1995
Article ID: Q136279
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, version 3.0

SYMPTOMS

Clicking the Find button on a Wizard-generated form and selecting an operator (or typing a value) that is not compatible with the data type of the selected field results in this error message:

   Function argument value, type, or count is invalid

CAUSE

The Visual FoxPro Form Wizard does not implicitly call an error-handling procedure.

RESOLUTION

The developer needs to implement an error-handling routine to trap for any errors that occur, call it in the Init event procedure of the Wizard- generated form, and set it back to the default in the Destroy event. The procedure itself can be contained in a .prg file that also calls the form.

Step-by-Step Example

The following example shows how to implement a simple error-handling routine similar to the FoxPro version 2.6 Screen Wizard.

  1. Create a form by using the Form Wizard.

  2. Modify the form, and in the form's Init event procedure, add this code:

    On Error Do MyErrorHandler in CallProg

  3. In the form's Destroy event procedure, add "On Error" (without the quotation marks). Now, closing the form will reset the error routine to the one Visual FoxPro uses by default.

  4. Exit and save the form.

  5. Create the following program, and name it CallProg:

    DO FORM <formname>

    PROCEDURE MyErrorHandler

          WAIT WINDOW MESSAGE()
    

  6. Close and save the program. Use the DO command to run it. Cause the the error. Now the error message is displayed in the Wait window. The user is no longer given options that could disable the form's functionality.

STATUS

This behavior is by design.


Additional reference words: 3.00 VFoxWin handler
KBCategory: kbtool kbcode kbprb
KBSubcategory: FxtoolWizscreen


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: September 10, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.