語言

ListBox.GetSelectedIndices 方法

定義

取得控制項中目前選取項目 ListBox 的索引值陣列。

public:
 virtual cli::array <int> ^ GetSelectedIndices();
public virtual int[] GetSelectedIndices();
abstract member GetSelectedIndices : unit -> int[]
override this.GetSelectedIndices : unit -> int[]
Public Overridable Function GetSelectedIndices () As Integer()

傳回

Int32[]

一個整數陣列,每個整數代表列表中所選項目的索引。

備註

使用此 GetSelectedIndices 方法來識別或存取控制中 ListBox 所選項目。 回傳陣列中的每個元素代表所選清單項目的索引。 你可以用索引值來存取收藏中的 Items 項目。

適用於

另請參閱