Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleClick on ListView columns to order a list
KeywordsListView, sort, column
CategoriesControls, Algorithms
 
In the ListView control's ColumnClick event handler, set the SortKey property to indicate the sort column.
 
Private Sub ListView1_ColumnClick(ByVal ColumnHeader As _
    MSComctlLib.ColumnHeader)
    ListView1.SortKey = ColumnHeader.Index - 1
End Sub
 
This program also shows how to make the ListView display data in different formats: icon, small icon, list, or report.
 
Private Sub mnuViewChoice_Click(Index As Integer)
Dim i As Integer

    ' Display the selected view style.
    ListView1.View = Index
    
    ' Check this menu item.
    For i = 0 To 3
        If i = Index Then
            mnuViewChoice(i).Checked = True
        Else
            mnuViewChoice(i).Checked = False
        End If
    Next i
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated