Results 1 to 6 of 6

Thread: Sorting lisview (SOLVED)

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2003
    Posts
    68

    Sorting lisview (SOLVED)

    I have put some code to sort listview detail when columnclick.

    I would like to display the sorted column in grey like explorer.

    Private Sub ListView1_ColumnClick(ByVal sender As Object, ByVal e As System.Windows.Forms.ColumnClickEventArgs) Handles ListView1.ColumnClick
    ' Determine if the clicked column is already the column that is
    ' being sorted.
    If (e.Column = lvwColumnSorter.SortColumn) Then
    ' Reverse the current sort direction for this column.
    If (lvwColumnSorter.Order = SortOrder.Ascending) Then
    lvwColumnSorter.Order = SortOrder.Descending
    Else
    lvwColumnSorter.Order = SortOrder.Ascending
    End If
    Else
    ' Set the column number that is to be sorted; default to ascending.
    lvwColumnSorter.SortColumn = e.Column
    lvwColumnSorter.Order = SortOrder.Ascending
    End If

    ' Perform the sort with these new sort options.
    Me.ListView1.Sort()
    'Me.ListView1.Columns.Item(e.Column). = Color.LightGray ?????


    End Sub


    What the exact code ???

    Thanks
    Last edited by oxbow123; Jun 12th, 2003 at 07:58 AM.

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    What's this variable : lvwColumnSorter ?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2003
    Posts
    68
    Private lvwColumnSorter As ListViewColumnSorter


    ListViewColumnSorter is a class where compare function is coded



  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    VB Code:
    1. Me.ListView1.Columns.Item(0).ListView.Items(0).BackColor = Color.LightGray

  5. #5

    Thread Starter
    Lively Member
    Join Date
    May 2003
    Posts
    68
    it is the line which is in grey and not the column

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by oxbow123
    it is the line which is in grey and not the column
    I don't think there is such a property then for setting the column backcolor in details view .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width