﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WinForms (How do I?)  » How to use the ListView Grouping?</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Mon, 01 Jun 2026 14:07:28 GMT</lastBuildDate><ttl>20</ttl><item><title>How to use the ListView Grouping?</title><link>http://forum.strataframe.net/FindPost16899.aspx</link><description>Hi Trent, &lt;P&gt;I saw this listview from one of your videos and now I have the need to incorporate this grouping feature in one of my listview.&lt;/P&gt;&lt;P&gt;&lt;IMG src="http://forum.strataframe.net/Uploads/Images/64629a59-45c0-4e87-819d-9e1e.png"&gt;&lt;/P&gt;&lt;P&gt;I looked in the forum and the help file and could not find any info about how to do this.&amp;nbsp; Could you please&amp;nbsp;post some sample code on how to accomplish this grouping display in the listview?</description><pubDate>Tue, 10 Jun 2008 09:07:08 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: How to use the ListView Grouping?</title><link>http://forum.strataframe.net/FindPost16957.aspx</link><description>Nope, sorry. :ermm:</description><pubDate>Tue, 10 Jun 2008 09:07:08 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: How to use the ListView Grouping?</title><link>http://forum.strataframe.net/FindPost16931.aspx</link><description>One more thing, is there a way to add an image to the GroupHeader only?</description><pubDate>Mon, 09 Jun 2008 15:13:44 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: How to use the ListView Grouping?</title><link>http://forum.strataframe.net/FindPost16927.aspx</link><description>Glad it helped, Edhy. ;)</description><pubDate>Mon, 09 Jun 2008 14:06:06 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item><item><title>RE: How to use the ListView Grouping?</title><link>http://forum.strataframe.net/FindPost16922.aspx</link><description>[quote][b]Trent L. Taylor (06/09/2008)[/b][hr]When you set the e.GroupHeaderText value, any row that has the same text will appear in the same group. That is it...not anything more to it.&lt;br&gt;
So if you are trying to sort, you could include this as part of a BO sort or part of a query sort. Hope that makes sense.[/quote]&lt;br&gt;
&lt;br&gt;
Trent, Ivan,&lt;br&gt;
That was it, having the proper ORDER BY in the fill method of the BO and just setting the GroupHeaderText to a value that is part of the row will do the trick.  This is my code:&lt;br&gt;
[quote][codesnippet]&lt;br&gt;
    Private Sub lvPaymentSchedule_RowPopulating(ByVal e As MicroFour.StrataFrame.UI.Windows.Forms.RowPopulatingEventArgs) Handles lvPaymentSchedule.RowPopulating&lt;br&gt;
             Dim loBO As PaymentScheduleBO&lt;br&gt;
             loBO = e.BusinessObject&lt;br&gt;
             e.UseGroup = True&lt;br&gt;
             e.GroupHeaderText = "Vehicle Group " &amp; loBO.FK_Vehicle.ToString&lt;br&gt;
    End Sub&lt;br&gt;
[/codesnippet][/quote]&lt;br&gt;
&lt;br&gt;
Thanks you both! :)&lt;br&gt;</description><pubDate>Mon, 09 Jun 2008 11:02:19 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: How to use the ListView Grouping?</title><link>http://forum.strataframe.net/FindPost16914.aspx</link><description>I don't understand your question, but the the rows are grouped based on the GroupHeaderText.&amp;nbsp; When you set the e.GroupHeaderText value, any row that has the same text will appear in the same group.&amp;nbsp; That is it...not anything more to it.&amp;nbsp; Also, if you eve set the e.UseGroup to False, this gets set for the entire grid, not a per item basis.&amp;nbsp; But it still needs to be set within this method in order to take action.&lt;/P&gt;&lt;P&gt;So if you are trying to sort, you could include this as part of a BO sort or part of a query sort.&amp;nbsp; Hope that makes sense.</description><pubDate>Mon, 09 Jun 2008 09:57:49 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: How to use the ListView Grouping?</title><link>http://forum.strataframe.net/FindPost16913.aspx</link><description>Have you tried sorting&amp;nbsp;the contents of your BO&amp;nbsp;on the column you are using for grouping?</description><pubDate>Mon, 09 Jun 2008 09:56:13 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item><item><title>RE: How to use the ListView Grouping?</title><link>http://forum.strataframe.net/FindPost16909.aspx</link><description>Ok, I have the group showing, but since this method is executing per row, how do I filter the rows to show in the correct group? so the records for group 1 will be show under group 1 and the records for group 2 will be shown in group 2 and so on.</description><pubDate>Mon, 09 Jun 2008 09:12:50 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: How to use the ListView Grouping?</title><link>http://forum.strataframe.net/FindPost16907.aspx</link><description>Hi Ivan,&lt;br&gt;
Thanks, that will get me going, will try now.</description><pubDate>Mon, 09 Jun 2008 08:18:39 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: How to use the ListView Grouping?</title><link>http://forum.strataframe.net/FindPost16905.aspx</link><description>Hey Edhy.&lt;P&gt;Just to get you going, use your ListView&amp;nbsp;RowPopulating Event to set e.UseGroup to True. Then you set the e.GroupHeaderText to the Group you want and it should work. Something like: &lt;P&gt;[codesnippet]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Sub MyListView_RowPopulating(ByVal e As MicroFour.StrataFrame.UI.Windows.Forms.RowPopulatingEventArgs) _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Handles MyListView.RowPopulating&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; With CType(e.BusinessObject, MyBO)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- Set Columns&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.Values(0).DisplayValue = Something&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.Values(1).DisplayValue = SomethingElse&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.UseGroup = True&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select Case .myField&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case SomeCondition1&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.GroupHeaderText = "Group1"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- here you can even set an image, for example from a ImageListControl&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.ImageIndex = 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case SomeCondition2&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.GroupHeaderText = "Group2"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.ImageIndex = 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case SomeCondition3&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.GroupHeaderText = "Group3"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.ImageIndex = 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case SomeCondition4&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.GroupHeaderText = "Group4"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.ImageIndex = 4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case Else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.GroupHeaderText = "Not Defined"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.ImageIndex = 5&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Select&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End With&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;/P&gt;&lt;/FONT&gt;[/codesnippet]</description><pubDate>Mon, 09 Jun 2008 08:13:23 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item></channel></rss>