The information in this article applies to:
SUMMARYThe Assert method of the Debug object allows monitoring of an expression for failure conditions. MORE INFORMATIONThe following syntax is used for the Assert method: Debug.Assert (expression)The Assert method syntax has the following object qualifier and part:
The Assert method forces a design-time break at the Assert statement when
the expression evaluates to False. If the expression evaluates as True,
program operation continues. For example:
If you call myFunction as:
the program continues as normal. However, passing a zero as any one of the
parameters forces a break. The following example breaks at the Assert
statement:
The above example allows testing for inappropriate parameters to protect
against a division by zero error. If a break occurs at the Assert
statement, you can check the locals window to determine which value is
inappropriate. This is especially useful when the argument values come from
other functions:
The Assert method is only used for debugging. During compiling, Microsoft
Visual Basic always removes Assert statements from the final code. There is
no workaround for this behavior.
Additional query words: kbVBp500 kbVBp600 kbVBp kbdsd kbDSupport kbNoKeyWord
Keywords : kbGrpVB |
Last Reviewed: January 5, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |