How to sort different columns of different type of listview in VB.Net?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: How to sort different columns of different type of listview in VB.Net?

  1. #1
    Join Date
    Feb 2012
    Location
    Prizren
    Posts
    37

    Post How to sort different columns of different type of listview in VB.Net?

    Using Microsoft Visual Studio 2010 Ultimate - VB.Net

    I'm writing an application where as many of other applications fulfill the requirements to be as an app , having it's statistics schema. Thus I made a form where I have a combox(of query category), a textbox(as searchfield), two datetimepickers(from and to) a listview and a button to fire the event with functions in it. I'm all set except for a minor issue I've encountered during my very first experiments with ListView control. Thus far I didn't know that VB users are stuck with that control's property options (whereas DataGridView has way too many), especially when it came to Column reordering/s. With the simple but not satisfying property Sort I couldn't find a proper solution to my issue.

    So frankly I'm asking for help that when I click on of the columns in the listview to do a Number/Date/Text reordering (descending>ascending, via-verse). Not to forget to mention there a limited number of columns most likely 2-4 max.

    The listview control has lvResults name and has for now columns inserted as "Country" and the other for subitems "Total Spent".

    One e.g. of the values inserted to it is like this :

    Country Total Spent

    Germany 129.02
    England 68.58
    Sweden 88.80
    Albania 15.75
    Turkey 38.22
    Kosova 100.50
    If pressed on Total Spent, should reorder from highest to the lowest number and via-versa.
    If pressed on Country should reorder from A to Z or via-versa.

  2. #2
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,987

    Re: How to sort different columns of different type of listview in VB.Net?

    Why not use a DB GridView?
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Feb 2012
    Location
    Prizren
    Posts
    37

    Re: How to sort different columns of different type of listview in VB.Net?

    That's something I've already mastered in case I cannot find the solution I'll switch to DB grid view.

    But I intend to learn listview because I'm doing with several values , a short list of it.

    Still looking forward to see if anyone could help me through.

    Regards.

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,092

    Re: How to sort different columns of different type of listview in VB.Net?


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center