語言

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 性質常用於遍歷集合以確定集合的上界。

適用於

另請參閱