Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

vb listview sorting

Posted on 2009-03-30
1
Medium Priority
?
275 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 48

Accepted Solution

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

Wayne
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

604 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