Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 9th, 2004, 08:53 PM
Authorized User
 
Join Date: Jul 2003
Location: KL, WP, Malaysia.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to hplim18
Default How to put Desc/Asc triangle symbol on List View?

Does anyone know how to put Desc Triangle symbol on List View Column Heading when it is set to have Descending sorting and change to Asc triangle symbol on the list view column heading when it is set to have Ascending sorting?

Thanks a lot in advanced!!!

Jeannie....
__________________
Jeannie....
Reply With Quote
  #2 (permalink)  
Old May 10th, 2004, 12:17 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Alameda, ca, USA.
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is a snipped of the code I use. My icons are in a ImageList (imgList) control.
You can find all the API definitions in the APIViewer. Sorry if did not post the whole thing, it is just a big UserControl that I designed. Call this code anytime the sorting mode changes.

Marco


    Dim hColHeader As Long
    Dim hItem As HDITEM
    Dim k As Long
    Dim bAlignRight As Boolean

    hColHeader = SendMessage(lstData.hwnd, LVM_GETHEADER, 0, 0)
    SendMessage hColHeader, HDM_SETIMAGELIST, 0, ByVal imgList.hImageList

    For k = 0 To lstData.ColumnHeaders.Count - 1
        bAlignRight = (lstData.ColumnHeaders.Item(k + 1).Alignment = lvwColumnRight)
        hItem.mask = HDI_FORMAT Or HDI_IMAGE
        If bAlignRight Then
            hItem.fmt = HDF_STRING Or HDF_RIGHT
        Else
            hItem.fmt = HDF_STRING
        End If
        If k = lstData.SortKey Then
            hItem.fmt = hItem.fmt Or HDF_IMAGE
            If bAlignRight Then hItem.fmt = hItem.fmt Or HDF_BITMAP_ON_RIGHT
        End If
        hItem.iImage = _
            imgList.ListImages(IIf(lstData.SortOrder, cAscending, cDescending)).index - 1
        SendMessage hColHeader, HDM_SETITEM, k, hItem
    Next
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
put mailto: links on list items in a combo box? webwolf Flash (all versions) 0 September 12th, 2008 08:01 AM
Help Grid View Drop Down List, view all jskinner123 ASP.NET 2.0 Basics 0 November 25th, 2007 06:25 PM
populate details view or list view non empty rows iinfoque ASP.NET 2.0 Basics 0 March 11th, 2007 06:11 AM
Pascal Triangle mistry_bhavin C++ Programming 2 November 15th, 2005 01:43 AM
list view help anilkumar VS.NET 2002/2003 0 January 22nd, 2004 12:48 AM



All times are GMT -4. The time now is 08:28 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.