ListView.LabelEdit Property


Gets or sets a value indicating whether the user can edit the labels of items in the control.

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

member LabelEdit : bool with get, set

Property Value

Type: System.Boolean

true if the user can edit the labels of items at run time; otherwise, false. The default is false.

When the LabelEdit property is set to true, the user is able to modify the text of an item by clicking the item text to select it and then clicking the item text again to put the label text into edit mode. The user can then modify or replace the item's text label. You can use the BeforeLabelEdit and AfterLabelEdit events to perform tasks before and after the user edits an item's text. The text of subitems cannot be modified if this property is set to true. To change the text of subitems, you can display a dialog box to users when they double-click a subitem in the control.


If the Activation property is set to OneClick or TwoClick, label editing will not be allowed regardless of the value of the LabelEdit property.

The following code example creates a ListView control with three ListViewItem objects specified and three ListViewItem.ListViewSubItem objects specified for each item. The example also creates ColumnHeader objects to display the subitems in details view. Two ImageList objects are also created in the code example to provide images for the ListViewItem objects. These ImageList objects are added to the LargeImageList and SmallImageList properties. The example uses the following properties in creating the ListView control.

This example requires that you have added the code to a Form and call the method created in the example from the constructor or another method on the form. The example also requires that images named MySmallImage1, MySmallImage2, MyLargeImage1, and MyLargeImage2 are located in the root directory of drive C.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top