Solved

vb listview sorting

Posted on 2009-03-30
1
258 Views
Last Modified: 2012-05-06
hello there,
im trying to get this sort listview that sorts out the list but its not working right.. can someone help me out here?
Module ColumnSort
    Private Declare Function LockWindowUpdate Lib "user32" (ByVal hWndLock As Integer) As Integer
	Public Sub SotrListView(ByVal lstView As ListView, ByVal ColumnHeader As MSComctlLib.ColumnHeader, Optional ByVal TypeSort As String = "NUMBER")
        With lstView
            lngCursor = .MousePointer
 
            .MousePointer = System.Windows.Forms.Cursors.WaitCursor
 
            LockWindowUpdate(.hwnd)
            lngIndex = ColumnHeader.Index - 1
 
            Select Case UCase(TypeSort)
                Case "NUMBER"
                    strFormat = New String("0", 30) & "." & New String("0", 30)
                    With .ListItems
 
                        With .Item(l).ListSubItems(lngIndex)
                            .Text = "&" & InvNumber(VB6.Format(0 - CDbl(Val(.Text)), strFormat))
                        End With
                    End With
 
                    .SortOrder = (.SortOrder + 1) Mod 2
                    .SortKey = ColumnHeader.Index - 1
                    .Sorted = True
 
                Case Else
                    .SortOrder = (.SortOrder + 1) Mod 2
                    .SortKey = ColumnHeader.Index - 1
                    .Sorted = True
            End Select
            .MousePointer = lngCursor
        End With
	End Sub
End Module

Open in new window

0
Comment
Question by:XK8ER
1 Comment
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 500 total points
ID: 24017757
See here for how to sort a listview -> http:/Q_22484062.html

Wayne
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question