ColumnReorderedEventArgs ColumnReorderedEventArgs ColumnReorderedEventArgs ColumnReorderedEventArgs Class


Provides data for the ColumnReordered event.

public ref class ColumnReorderedEventArgs : System::ComponentModel::CancelEventArgs
public class ColumnReorderedEventArgs : System.ComponentModel.CancelEventArgs
type ColumnReorderedEventArgs = class
    inherit CancelEventArgs
Public Class ColumnReorderedEventArgs
Inherits CancelEventArgs


The following code example demonstrates the use of this type. In the example, an event handler reports on the occurrence of the ColumnReordered event. This report helps you to learn when the event occurs and can assist you in debugging. To report on multiple events or on events that occur frequently, consider replacing Show with Console.WriteLine or appending the message to a multiline TextBox.

To run the example code, paste it into a project that contains an instance of type ListView named ListView1. Then ensure that the event handler is associated with the ColumnReordered event.

private void ListView1_ColumnReordered(Object sender, ColumnReorderedEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "OldDisplayIndex", e.OldDisplayIndex );
messageBoxCS.AppendFormat("{0} = {1}", "NewDisplayIndex", e.NewDisplayIndex );
messageBoxCS.AppendFormat("{0} = {1}", "Header", e.Header );
messageBoxCS.AppendFormat("{0} = {1}", "Cancel", e.Cancel );
MessageBox.Show(messageBoxCS.ToString(), "ColumnReordered Event" );
Private Sub ListView1_ColumnReordered(sender as Object, e as ColumnReorderedEventArgs) _ 
     Handles ListView1.ColumnReordered

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "OldDisplayIndex", e.OldDisplayIndex)
    messageBoxVB.AppendFormat("{0} = {1}", "NewDisplayIndex", e.NewDisplayIndex)
    messageBoxVB.AppendFormat("{0} = {1}", "Header", e.Header)
    messageBoxVB.AppendFormat("{0} = {1}", "Cancel", e.Cancel)
    MessageBox.Show(messageBoxVB.ToString(),"ColumnReordered Event")

End Sub


The ColumnReordered event can be canceled by setting the Cancel property to true. However, if the event is cancelled, the NewDisplayIndex will not change to the OldDisplayIndex value.


ColumnReorderedEventArgs(Int32, Int32, ColumnHeader) ColumnReorderedEventArgs(Int32, Int32, ColumnHeader) ColumnReorderedEventArgs(Int32, Int32, ColumnHeader) ColumnReorderedEventArgs(Int32, Int32, ColumnHeader)

Initializes a new instance of the ColumnReorderedEventArgs class.


Cancel Cancel Cancel Cancel

Gets or sets a value indicating whether the event should be canceled.

(Inherited from CancelEventArgs)
Header Header Header Header

Gets the ColumnHeader that is being reordered.

NewDisplayIndex NewDisplayIndex NewDisplayIndex NewDisplayIndex

Gets the new display position of the ColumnHeader

OldDisplayIndex OldDisplayIndex OldDisplayIndex OldDisplayIndex

Gets the previous display position of the ColumnHeader.


Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to