﻿<?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?)  » Sorting problem with ListView</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 00:57:25 GMT</lastBuildDate><ttl>20</ttl><item><title>Sorting problem with ListView</title><link>http://forum.strataframe.net/FindPost23508.aspx</link><description>&lt;FONT color=#111111&gt;Hi Trent,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;&lt;FONT color=#111111 size=2&gt;I am using code like the below in the Load event to sort the first column of the ListView:&lt;BR&gt;Me.dSearchCategoriesBO1.Sort = "DisplayOptionOrder"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;&lt;FONT color=#111111 size=2&gt;But that is causing a problem when I click the Add button within that ListView. It comes as an Edit mode&amp;nbsp;and shows me the current record in the ListView. I cancelled that&amp;nbsp;and click again the Add button&amp;nbsp;and then it works fine. The work around this problem was when I entered the following within this event: lstSearchCategories_BeforeChildFormExecuted as this one: &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;&lt;FONT color=#111111 size=2&gt;&lt;BR&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; e.Action = MicroFour.StrataFrame.UI.ListViewChildFormAction.Add &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.GrandChildSearchCategoriesBO1.Sort = &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;""&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;BR&gt;Then in the ListView ChildFormResults event&amp;nbsp;I entered this code:&lt;BR&gt;Me.dSearchCategoriesBO1.Sort = "DisplayOptionOrder"&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT size=2&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;BR&gt;&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description><pubDate>Mon, 15 Jun 2009 13:17:34 GMT</pubDate><dc:creator>Doron Farber</dc:creator></item><item><title>RE: Sorting problem with ListView</title><link>http://forum.strataframe.net/FindPost23511.aspx</link><description>It is always dangerous setting the Sort on and off like that when you are adding records.  You can find all types of posts out here about that sort of thing.  Just turn on the sort while populating the list and then turn it off in the AfterRequery.  When you leave a sort on a BO then add records, you are going to have issues. I know without digging to hard that your issue is going to be related to the sort of the BO somehow.</description><pubDate>Mon, 15 Jun 2009 13:17:34 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Sorting problem with ListView</title><link>http://forum.strataframe.net/FindPost23509.aspx</link><description>Hi Trent,&lt;BR&gt;&lt;BR&gt;Ignore the prev Thread, went out too early.:)&lt;P&gt;I am using code like the below in the Load event to sort the first column of the ListView:&lt;BR&gt;Me.dSearchCategoriesBO1.Sort = "DisplayOptionOrder"&lt;/P&gt;&lt;P&gt;But that is causing a problem when I click the Add button within that ListView. It comes as an Edit mode and shows me the current record in the ListView. I cancelled that and click again the Add button and then it works fine. The work around this problem was when I entered the following within this event: lstSearchCategories_BeforeChildFormExecuted as this one: &lt;/P&gt;&lt;P&gt;If e.Action = MicroFour.StrataFrame.UI.ListViewChildFormAction.Add Then&lt;BR&gt;&amp;nbsp;Me.GrandChildSearchCategoriesBO1.Sort = ""&lt;BR&gt;End If&lt;/P&gt;&lt;P&gt;Then in the ListView ChildFormResults event I entered this code:&lt;BR&gt;Me.dSearchCategoriesBO1.Sort = "DisplayOptionOrder"&lt;BR&gt;&lt;BR&gt;The original sorting is in a different field and that's why I used the BO.Sort &lt;BR&gt;Is there someting that needs to be improved somewhere?&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;Regards,&lt;BR&gt;&lt;BR&gt;Doron</description><pubDate>Mon, 15 Jun 2009 13:11:11 GMT</pubDate><dc:creator>Doron Farber</dc:creator></item></channel></rss>