Solved

vb listview sorting

Posted on 2009-03-30
1
257 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

932 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

12 Experts available now in Live!

Get 1:1 Help Now