This documentation is archived and is not being maintained.

LabelEditEventArgs Class

Provides data for the LabelEdit event.

For a list of all members of this type, see LabelEditEventArgs Members.


[Visual Basic]
Public Class LabelEditEventArgs
   Inherits EventArgs
public class LabelEditEventArgs : EventArgs
public __gc class LabelEditEventArgs : public EventArgs
public class LabelEditEventArgs extends EventArgs

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


A LabelEditEventArgs specifies the index and caption of a ListViewItem and the caption after it has been edited by the user. This class also provides the CancelEdit property, which enables code in an event handler for the LabelEdit event to cancel the changes made to the label by the user.


[Visual Basic, C#] The following code example demonstrates handling the ListView. BeforeLabelEdit event and using the System.Windows.Forms.EditLabelEventArgs class. To run the example, paste the following code in a form containing a ListView control named ListView1 and populated with at least 3 items.

[Visual Basic] 

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

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;

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.


Namespace: System.Windows.Forms

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System.Windows.Forms (in System.Windows.Forms.dll)

See Also

LabelEditEventArgs Members | System.Windows.Forms Namespace | ListView | ListViewItem