CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2012
    Posts
    46

    [RESOLVED] [VS 2010 .NET] Add Sorting & Grouping to Listview

    I am having difficulties finding relevant information regarding listview sorting and grouping. The following picture shows the listview I am trying to sort/group.
    Listview.jpg

    I am attempting to group not only by "Part Type" but by also to group certain part choices together (when a motor part is chosen that parts as well as matching motor parts to complete the setup are pulled from the DB and these should be grouped together by each choice rather than by "Part Type").

    I have tried MSDN, CodeGuru, DreamInCode, and have Googled the topic for 2 days but have not found a relevant example for databound item listview grouping/sorting.

    If you have any leads for me they would be greatly appreciated.

    Thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: [VS 2010 .NET] Add Sorting & Grouping to Listview

    If a Listview had GROUPING built-in, you'd find millions of samples, right? You might need to re-think the control that you are using, or at least not BIND it to any data source.
    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
    Jul 2012
    Posts
    46

    Re: [VS 2010 .NET] Add Sorting & Grouping to Listview

    Listviews do have grouping and I have found samples that group by using IComparer class but never for databound items. The databinding is unavoidable and I don't know what other control I would be able to use as a suitable substitute. I was trying to figure this out rather than possibly destroying a week and a half of work. But it seems as if I have gone in over my head.

  4. #4
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: [VS 2010 .NET] Add Sorting & Grouping to Listview

    That would be SUB-CLASSING the LV, or in essence, creating your own LV w/additional properties. You *could* probably create a USER-CONTROL that had all the properties wrapped into one, like I was hinting at before.
    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!

  5. #5
    Join Date
    Jul 2012
    Posts
    46

    Re: [VS 2010 .NET] Add Sorting & Grouping to Listview

    I will have to find a workaround. I fear that creating my own control will be a waste of time for me as I would be learning as I go.
    Thank you for your help dglienna.

  6. #6
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: [RESOLVED] [VS 2010 .NET] Add Sorting & Grouping to Listview

    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!

  7. #7
    Join Date
    Jul 2012
    Posts
    46

    Re: [RESOLVED] [VS 2010 .NET] Add Sorting & Grouping to Listview

    Thank you, that's good to know. But I have decided to go a different route (no listview) to get the product my boss wants.

    Cheers!

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured