次の方法で共有


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);
}

関連項目

参照

Errors インターフェイス
Errors のメンバ
Microsoft.Office.Interop.InfoPath 名前空間