ListView.OnColumnClick Method (ColumnClickEventArgs)

 

Raises the ColumnClick event.

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

abstract OnColumnClick : 
        e:ColumnClickEventArgs -> unit
override OnColumnClick : 
        e:ColumnClickEventArgs -> unit

Parameters

e
Type: System.Windows.Forms.ColumnClickEventArgs

A ColumnClickEventArgs that contains the event data.

Raising an event invokes the event handler through a delegate. For more information, see Handling and Raising Events.

The OnColumnClick method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

Notes to Inheritors:

When overriding OnColumnClick in a derived class, be sure to call the base class's OnColumnClick method so that registered delegates receive the event.

The following code example creates a form that contains a ListView control that manually sorts items when a column in the ListView control is clicked. The example defines a class called ListViewItemComparer that implements the System.Collections.IComparer interface that performs the ListViewItem comparison. The example creates an instance of ListViewItemComparer and uses it to set the ListViewItemSorter property of the ListView control. The Sort method call in the ColumnClick event handler uses the methods defined in ListViewItemComparer to perform the sort of items, based on the column that is clicked.

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

.NET Framework
Available since 1.1
Return to top
Show: