O'Reilly logo

Visual Basic® .NET Database Programming by Rod Stephens

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sorting Records

The way in which a ListView’s rows are sorted depends on its ListViewItemSorter property. This property gets or sets a reference to an object that implements the IComparer interface. That interface defines a Compare method that the ListView uses when it needs to sort its items.

The ListViewSorter class, shown in Listing 12.5, implements this interface. Its SortColumn property tells the object which ListView column the user clicked. If the user clicked the first column, the Compare method calls the CompareItems method, passing it the text displayed by the two ListView items.

Each row in the ListView represents an item followed by subitems. If the user clicked a column other than the first, the program must sort the data using ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required