Errors.Count 屬性
取得包含在集合中的 ErrorObject 物件計數。
**命名空間:**Microsoft.Office.Interop.InfoPath
**組件:**Microsoft.Office.Interop.InfoPath (於 microsoft.office.interop.infopath.dll 中)
語法
'宣告
<DispIdAttribute(1)> _
ReadOnly Property Count As Integer
'用途
Dim instance As Errors
Dim value As Integer
value = instance.Count
[DispIdAttribute(1)]
int Count { get; }
範例
在下列範例中,Count 屬性是用於逐一查看 Error 物件的集合,並顯示訊息方塊,指出每個錯誤的簡短錯誤訊息:
for (int i=0; i < thisXDocument.Errors.Count; i++)
{
thisXDocument.UI.Alert("Error message: " + thisXDocument.Errors[i].ShortErrorMessage);
}