Microsoft KB Archive/136279

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

Article ID: 136279

Article Last Modified on 2/15/2000

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition

-



This article was previously published under Q136279



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.

 Create a form by using the Form Wizard.  Modify the form, and in the form's Init event procedure, add this code: On Error Do MyErrorHandler in CallProg  In the form's Destroy event procedure, add On Error. Now, closing the form will reset the error routine to the one Visual FoxPro uses by default. Exit and save the form.  Create the following program, and name it CallProg: DO FORM

PROCEDURE MyErrorHandler WAIT WINDOW MESSAGE  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.</li></ol>

<div class="status_section">

STATUS
This behavior is by design.

Additional query words: VFoxWin handler

Keywords: KB136279

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.