ListItemCollection.Count プロパティ

定義

コレクション内の ListItem オブジェクト数を取得します。

public:
 property int Count { int get(); };
public int Count { get; }
member this.Count : int
Public ReadOnly Property Count As Integer

プロパティ値

コレクションに含まれる ListItem オブジェクトの数です。

実装

完全に機能する例で次のコードを表示するには、クラスのトピックを ListItemCollection 参照してください。

// Set the number of rows displayed in the ListBox to be
// the number of items in the ListBoxCollection.
ListBox1.Rows = ListBox1.Items.Count;
' Set the number of rows displayed in the ListBox to be
' the number of items in the ListBoxCollection.
ListBox1.Rows = ListBox1.Items.Count

注釈

プロパティを Count 使用して、 内のオブジェクトの ListItem 数を確認します ListItemCollection。 プロパティは Count 、コレクションを反復処理してコレクションの上限を決定するときによく使用されます。

適用対象

こちらもご覧ください