次の方法で共有


ListView.SelectedListViewItemCollection.IndexOf メソッド

指定した項目のコレクション内のインデックスを返します。

Public Function IndexOf( _
   ByVal item As ListViewItem _) As Integer
[C#]
public int IndexOf(ListViewItemitem);
[C++]
public: int IndexOf(ListViewItem* item);
[JScript]
public function IndexOf(
   item : ListViewItem) : int;

パラメータ

  • item
    コレクション内で検索する項目を表す ListViewItem

戻り値

コレクション内の項目の、0 から始まるインデックス番号。項目がコレクション内で検出されなかった場合、戻り値は -1 です。

解説

(Contains メソッドを使用して) 選択された項目のコレクション内に項目があることがわかっている場合は、 IndexOf メソッドを使用して、 ListView.SelectedListViewItemCollection 内の項目の位置を確認できます。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

ListView.SelectedListViewItemCollection クラス | ListView.SelectedListViewItemCollection メンバ | System.Windows.Forms 名前空間 | Contains