Article ID: 156322 - Last Review: May 12, 2003 - Revision: 2.1 FIX: RETURN TO Procedurename Command Doesn't Work in FormsThis article was previously published under Q156322 On This PageSUMMARY
This article pertains to the use of the Error event of a control and the
RETURN TO command when trying to return to a method or event of a form or
class that is different from where the Error event was generated. When
using the RETURN TO command in a form or class, it will only return to the
method or event on some of FoxPro's error messages.
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. This bug has been fixed in Visual Studio
97 Service Pack 2.
For more information on the Visual Studio 97 Service Pack 2, please see the following article in the Microsoft Knowledge Base: 170365
(http://support.microsoft.com/kb/170365/EN-US/
)
INFO: Visual Studio 97 Service Packs - What, Where, and Why
MORE INFORMATION
The RETURN TO command is useful when the execution of code needs to be
redirected to a method or event further up in the call stack. One reason
for wanting to return to some method or event different from the calling
method or event would be when trying to bypass the remainder of code in the
event or method that is after the line of code that caused the error. For
example, a Click event of the command button might call a method that
executes some code. If this code causes an error, the Error event of the
command button could handle the error and then a RETURN TO command could be
used to return to the Click event of the command button without executing
the rest of the code in the method that it called.
The problem is that this works with only some of the FoxPro commands. For example, if the line of code that causes the error is "SET FILTER TO 10," the RETURN TO command does not work correctly. If the line of code is "WAIT WINDOW 10," the RETURN TO command works correctly. Both are syntax errors, but one works and the other does not. Steps to Reproduce Behavior
| Article Translations
|

Back to the top
