語言

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

索引可在本收藏中找到。

傳回

true 若 中指定的索引 ListBox.ObjectCollection 是 ListBox 集合中的項目;否則, false。

備註

此 Contains 方法可讓您判斷類別中的 ListBox.ObjectCollection 索引位置是否屬於儲存在 ListBox.SelectedIndexCollection的選取索引成員。 你可以用這個來判斷多重選擇 ListBox 中是否選中了特定項目。

適用於

另請參閱