LabelEditEventArgs Class
Provides data for the LabelEdit event.
For a list of all members of this type, see LabelEditEventArgs Members.
System.Object
System.EventArgs
System.Windows.Forms.LabelEditEventArgs
[Visual Basic] Public Class LabelEditEventArgs Inherits EventArgs [C#] public class LabelEditEventArgs : EventArgs [C++] public __gc class LabelEditEventArgs : public EventArgs [JScript] 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.
Remarks
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.
Example
[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 [C#] 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
in the upper-left corner of the page.
Requirements
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