Solved

vb listview sorting

Posted on 2009-03-30
1
256 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
Comment Utility
See here for how to sort a listview -> http:/Q_22484062.html

Wayne
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Exception in Log4Net 1 18
AutoHotkey ActiveX Component Error 8 55
Why don't I see this table in EDMX file? 2 19
XML & .net 5 16
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

743 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now