Responding to ListView Events

The ListView control can respond to editing and click events. The edit events are AfterLabelEdit and BeforeLabelEdit, and the click events are ColumnClick and ItemClick.

The BeforeLabelEdit event occurs after a previously selected item is selected again. If you set the LabelEdit property to 0 (lvwAutomatic) or if you invoke the StartLabelEdit method, the control generates only the AfterLabelEdit and the BeforeLabelEdit events.

Use the SelectedItem property to respond to a user’s edit of an object's label. The control generates the AfterLabelEdit event after the user finishes the editing operation, which occurs when the user chooses another ListItem or presses the ENTER key.

The ColumnClick event occurs only when the View property of the ListView control is set to lvwReport. In the ColumnClick event, the Sorted, SortKey, and SortOrder properties are commonly used to sort the ListItem objects. The ItemClick event occurs whenever a user selects an item.