Compartir a través de


ToolWindows.ErrorList Property

Gets the list of errors displayed in the IDE.

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

Syntax

'Declaration
ReadOnly Property ErrorList As ErrorList
ErrorList ErrorList { get; }
property ErrorList^ ErrorList {
    ErrorList^ get ();
}
abstract ErrorList : ErrorList with get
function get ErrorList () : ErrorList

Property Value

Type: EnvDTE80.ErrorList
An error list that can be enumerated for individual errors.

Examples

This add-in example opens the Error List window and displays the errors, if present, in a Message Box. Before running this example, build a project with some errors in it.

For more information about how to run this example as an add-in, see How to: Compile and Run the Automation Object Model Code Examples.

Imports EnvDTE
Imports EnvDTE80
Public Sub OnConnection(ByVal application As Object, _
 ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object _
, ByRef custom As Array) Implements IDTExtensibility2.OnConnection
    _applicationObject = CType(application, DTE2)
    _addInInstance = CType(addInInst, AddIn)
    GetErrorList(_applicationObject)
End Sub
Public Sub GetErrorList(ByVal dte As DTE2)
    Dim myErrors As ErrorList
    Dim count As Integer
    Dim aString As String
    aString = ""
    _applicationObject.ExecuteCommand("View.ErrorList", " ")
    myErrors = _applicationObject.ToolWindows.ErrorList
    count = myErrors.ErrorItems.Count
    If count <> 0 Then
        For k As Integer = 1 To count
            aString &= _
           (myErrors.ErrorItems.Item(k).Description.ToString() & vbCr)
        Next k
        MsgBox(aString)
    Else
         MsgBox("There are no items in the error list.")
    End If
End Sub
using EnvDTE;
using EnvDTE80;
using System.Windows.Forms;
public void OnConnection(object application,
 ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    GetErrorList(_applicationObject);
}
public void GetErrorList(DTE2 dte)
{
    ErrorList myErrors;
    int count;
    String aString = null;
    _applicationObject.ExecuteCommand("View.ErrorList", " ");
    myErrors = _applicationObject.ToolWindows.ErrorList;
    count = myErrors.ErrorItems.Count;
    if (count != 0)
    {
        for (int i = 1; i <= count; i++)
        {
            aString +=
(myErrors.ErrorItems.Item(i).Description.ToString() + "\n");
        }
        MessageBox.Show(aString);
    }
    else
    {
        MessageBox.Show("There are no items in the error list.");
    }
}

.NET Framework Security

See Also

Reference

ToolWindows Interface

EnvDTE80 Namespace