Error Handling
Statistica Visual Basic provides the same facilities for error handling as other general implementations of Visual Basic. Thus, detailed discussions on error handling can be found in the numerous general sources describing this programming language.
Sub Main ' Set the label where to go if an ' error occurs.
On Error GoTo DisplayVBError Dim x As Double, y As Double y=0
' Division-by-zero error
x=2/y Exit Sub
' An error occurred; Visual Basic maintains ' an object called Err with various properties; ' the Description property contains the description ' of the most recent error. DisplayVBError:
MsgBox Err.Description Exit Sub
End Sub
Visual Basic maintains and updates an object called Err. The property Err.Description contains the description of the most recent error. To clear the last error event, set Err to zero. It is generally good programming practice to write the subroutines and functions so that "clean" error-exits can be accomplished, i.e., that code is provided that explicitly handles any errors.
Statistica analysis errors. Errors that occur as part of the analysis inside a Statistica module (e.g., incorrect selection of variables) are handled in the same way as during the interactive analysis, i.e., the program will display a message box explaining the error that has occurred and how to remedy it.