LabelEditEventArgs.Item プロパティ

定義

編集対象のラベルを保持している ListViewItem の 0 から始まるインデックス番号を取得します。

public:
 property int Item { int get(); };
public int Item { get; }
member this.Item : int
Public ReadOnly Property Item As Integer

プロパティ値

ListViewItem の 0 から始まるインデックス番号。

次のコード例では、 イベントを処理し、 ListView.BeforeLabelEdit プロパティと CancelEdit プロパティを使用する方法をItem示します。 この例を実行するには、ListView1 という名前の ListView コントロールを含み、少なくとも 3 つの項目が設定されたフォームに次のコードを貼り付けます。 すべてのイベントがイベント処理メソッドに関連付けられていることを確認します。

void ListView1_BeforeLabelEdit( Object^ sender,
   System::Windows::Forms::LabelEditEventArgs^ e )
{
   // Allow all but the first two items of the list to 
   // be modified by the user.
   if ( e->Item < 2 )
   {
      e->CancelEdit = true;
   }
}
private void ListView1_BeforeLabelEdit(object sender, 
    System.Windows.Forms.LabelEditEventArgs e)
{
    // Allow all but the first two items of the list to 
    // be modified by the user.
    if (e.Item<2)
    {
        e.CancelEdit = true;
    }
}

Private Sub ListView1_BeforeLabelEdit(ByVal sender As Object, _
    ByVal e As System.Windows.Forms.LabelEditEventArgs) _
    Handles ListView1.BeforeLabelEdit

    ' Allow all but the first two items of the list to be modified by
    ' the user.
    If (e.Item < 2) Then
        e.CancelEdit = True
    End If
End Sub

適用対象