ToolWindows.ErrorList 屬性
取得 IDE 中顯示的錯誤清單。
命名空間: EnvDTE80
組件: EnvDTE80 (在 EnvDTE80.dll 中)
語法
'宣告
ReadOnly Property ErrorList As ErrorList
Get
ErrorList ErrorList { get; }
property ErrorList^ ErrorList {
ErrorList^ get ();
}
abstract ErrorList : ErrorList
function get ErrorList () : ErrorList
屬性值
型別:EnvDTE80.ErrorList
可為個別錯誤列舉的錯誤清單。
範例
這個增益集範例會開啟 [錯誤清單] 視窗並在 [訊息方塊] 中顯示錯誤。 在執行這個範例之前,請先建置含有某些錯誤的專案。
如需如何像執行增益集一般,執行這個範例的詳細資訊,請參閱 HOW TO:編譯和執行 Automation 物件模型程式碼範例。
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 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。