ListBox.SelectedIndexCollection.Contains(Int32) 方法

定義

判斷指定的索引是否位於集合中。

public:
 bool Contains(int selectedIndex);
public bool Contains (int selectedIndex);
member this.Contains : int -> bool
Public Function Contains (selectedIndex As Integer) As Boolean

參數

selectedIndex
Int32

要放置在集合中的索引。

傳回

Boolean

如果 ListBox.ObjectCollectionListBox 中的指定索引為這個集合中的項目,則為 true,否則為 false

備註

方法 Contains 可讓您判斷 類別中的 ListBox.ObjectCollection 索引位置是否為儲存在 中 ListBox.SelectedIndexCollection 所選索引的成員。 您可以使用此選項來判斷是否選取多重選取 ListBox 範圍中的特定專案。

適用於

另請參閱