ListBox.SelectedItems プロパティ

定義

ListBox 内で現在選択されている項目を格納するコレクションを取得します。

public:
 property System::Windows::Forms::ListBox::SelectedObjectCollection ^ SelectedItems { System::Windows::Forms::ListBox::SelectedObjectCollection ^ get(); };
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.ListBox.SelectedObjectCollection SelectedItems { get; }
[<System.ComponentModel.Browsable(false)>]
member this.SelectedItems : System.Windows.Forms.ListBox.SelectedObjectCollection
Public ReadOnly Property SelectedItems As ListBox.SelectedObjectCollection

プロパティ値

コントロール内で現在選択されている項目を格納している ListBox.SelectedObjectCollection

属性

注釈

複数選択 ListBoxの 場合、このプロパティは、 で選択されているすべての項目を含むコレクションを ListBox返します。 単一選択 ListBoxの場合、このプロパティは、 内で選択されている項目のみを含む 1 つの要素を含むコレクションを ListBox返します。 コレクションの項目を操作する方法の詳細については、「」を参照してください ListBox.SelectedObjectCollection

クラスには ListBox 、選択した項目を参照するさまざまな方法が用意されています。 プロパティを SelectedItems 使用して、単一選択 ListBoxで現在選択されている項目を取得する代わりに、 プロパティを SelectedItem 使用できます。 項目自体ではなく、 で ListBox現在選択されている項目のインデックス位置を取得する場合は、 プロパティを SelectedIndex 使用します。 さらに、 プロパティは SelectedIndices 、複数選択 ListBoxの 内のすべての選択項目のインデックス位置を取得する場合に使用できます。

適用対象