ListItemCollection.Count 屬性

定義

取得集合中 ListItem 物件的數目。

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

屬性值

Int32

集合中 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使用 屬性來判斷 中的 ListItemCollection 物件數目 ListItem 。 在 Count 逐一查看集合以判斷集合的上限時,通常會使用 屬性。

適用於

另請參閱