?
Solved

vb listview sorting

Posted on 2009-03-30
1
Medium Priority
?
269 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 47

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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

764 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