Executes the specified statement. If the TreatAsExpression flag is true, then the string is interpreted as an expression, and output is sent to the Command Window.
Public Sub ExecuteStatement( _ ByVal Statement As String, _ Optional ByVal Timeout As Integer = -1, _ Optional ByVal TreatAsExpression As Boolean = False _ )
Sub ExecuteStatement( _ ByVal Statement As String, _ Optional ByVal Timeout As Long = -1, _ Optional ByVal TreatAsExpression As Boolean = False _ )
HRESULT __stdcall ExecuteStatement( BSTR Statement, long Timeout, VARIANT_BOOL TreatAsExpression );
public void ExecuteStatement( string Statement, int Timeout, bool TreatAsExpression );
public function ExecuteStatement( Statement : String, Timeout : int, TreatAsExpression : Boolean )
- The statement to execute.
- The timeout period, in milliseconds.
- The treat as expression. True if the string is to be interpreted as an expression; otherwise False.
Executes the specified statement. A statement differs from an expression in that a statement can consist of one or more expressions; therefore, typically no value can be associated or returned by statement execution.
Some languages, such as Visual Basic, support a language syntax whereby the context in which a statement appears indicates how the statement should be evaluated. For example, if your VB code has statement
a = 1, it is interpreted as an expression if the code appears inside an If Then statement. In that case, it is interpreted as a statement if it appears alone on a line. The expression will test
a against the value of 1, the statement will set
a equal to 2. See the Example below.
Output from this method is sent to the Command Window.
' The following executes a statement, effectively ' setting a to the value of 2. Sub SetVariable() DTE.Debugger.ExecuteStatement("a = 2", -1, False) End Sub ' The following tests the value of a against ' the value of two. False is displayed in the command window. Sub TestVariable() DTE.Debugger.ExecuteStatement("a = 2", -1, True) End Sub
Applies To: Debugger Object