1. Create a Class that implements
See the example in the
2. Set the
] property to the
Quote:You can use this property to provide custom sorting, for example, when a column header is clicked in the details view. To do this, create a class that implements the IComparer interface and provides a constructor that accepts the index of a column to sort by. You can then implement a handler for the ColumnClick event that creates an instance of this class using the index of the clicked column. When you set the
ListViewItemSorter property to the new instance, the ListView control is automatically sorted using the specified object. Subsequent calls to the Sort method use the same object.
Put all of the statements within the
function within a
statement and, after you have debugged the code,
block. In my experience, I had to do this because sometimes the
function was called and an error occurred during the
function. It has been awhile since I experienced this so I don't remember the exact circumstances but I remember it was when the
control was in a state where it shouldn't have been trying to sort the rows. I think it might have been because the
function was called when the
was set but I am not sure.