Breakpoint2.Enabled Property

Sets or returns the enabled state of the breakpoint.

Namespace:  EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.dll)

Syntax

'Declaration
Property Enabled As Boolean
bool Enabled { get; set; }
property bool Enabled {
    bool get ();
    void set (bool value);
}
abstract Enabled : bool with get, set
function get Enabled () : boolean
function set Enabled (value : boolean)

Property Value

Type: System.Boolean
A boolean value that is true if the breakpoint is enabled, otherwise false.

Implements

Breakpoint.Enabled

Examples

The following example demonstrates how to use the Enabled property.

To test this property:

  1. Set a breakpoint in the target application.

  2. Run the add-in.

    The breakpoint state is enabled.

  3. Disable the breakpoint by using a mouse right-click.

  4. Run the add-in.

    The breakpoint state is disabled.

public static void Enabled(EnvDTE80.DTE2 dte)
{
    // Setup debug Output window.
    Window w = (Window)dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
    w.Visible = true;
    OutputWindow ow = (OutputWindow)w.Object;
    OutputWindowPane owp = ow.OutputWindowPanes.Add("Enabled property: ");
    owp.Activate();

    // dte is a reference to the DTE2 object passed to you by the
    // OnConnection method that you implement when you create an Add-in.
    EnvDTE80.Debugger2 debugger = (EnvDTE80.Debugger2)dte.Debugger;
    owp.OutputString("Breakpoint in the file " + debugger.Breakpoints.Item(1).File);
    owp.OutputString(" on line " +
                     debugger.Breakpoints.Item(1).FileLine.ToString() + " column ");
    owp.OutputString(debugger.Breakpoints.Item(1).FileColumn.ToString() + " is ");
    owp.OutputString(debugger.Breakpoints.Item(1).Enabled ? "enabled." : "disabled.");
    owp.OutputString("\nThis breakpoint is in the function: " +
                     debugger.Breakpoints.Item(1).FunctionName);
}
Sub EnabledSamplesVB(ByVal dte As DTE2)

    If MsgBox("Disable all breakpoints?", MsgBoxStyle.YesNo) _
        = MsgBoxResult.Yes Then
        Dim bp As Breakpoint
        For Each bp In dte.Debugger.Breakpoints
            bp.Enabled = False
        Next
    End If

End Sub

.NET Framework Security

See Also

Reference

Breakpoint2 Interface

EnvDTE80 Namespace

Other Resources

How to: Compile and Run the Automation Object Model Code Examples