Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
ASSERT Command
Collapse the table of content
Expand the table of content

ASSERT Command

Visual Studio .NET 2003

Displays a message box when a logical expression evaluates to False (.F.).

ASSERT lExpression [MESSAGE cMessageText]


Specifies the logical expression that is evaluated. If lExpression evaluates to a logical False (.F.), a debugging dialog box is displayed. If lExpression evaluates to a logical True (.T.), the dialog box is not displayed.
Specifies the text displayed in the debugging dialog box. If you omit cMessageText, the default text is displayed, indicating the line number on which the assertion failed and procedure containing the assertion.


This command is ignored if the SET ASSERTS command is set to OFF.

The message box contains Cancel, Debug, Ignore and Ignore All buttons. The following table describes the action performed when each button is chosen.

Button Action
Debug Program execution is suspended and the Debugger window is displayed with the Trace window active.
Cancel Program execution is ended.
Ignore Program execution continues with the line following the ASSERT command.
Ignore All Program execution continues with the line following the ASSERT command and ASSERTS is set to OFF. Subsequent ASSERT commands are ignored until ASSERTS is set to ON.

See Also

Debugger Window, | SET ASSERTS | Setting Asserts

© 2015 Microsoft