次の方法で共有


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

注釈

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

適用対象

こちらもご覧ください