﻿<?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 » Business Objects and Data Access (How do I?)  » How do I fill an MRU list?</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:17:18 GMT</lastBuildDate><ttl>20</ttl><item><title>How do I fill an MRU list?</title><link>http://forum.strataframe.net/FindPost17583.aspx</link><description>I have dropped a DevEx&amp;nbsp;MRUEdit control onto a form for the first time.&amp;nbsp; Cool little control.&amp;nbsp; I want to fill this thing with a distinct list of part descriptions.&amp;nbsp; Here is my working code for your review:&lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;private&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;void&lt;/FONT&gt;&lt;FONT size=2&gt; FillPartDescriptionMRU()&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;// get the distinct list of part descriptions&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;SqlConnection&lt;/FONT&gt;&lt;FONT size=2&gt; cn = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;SqlConnection&lt;/FONT&gt;&lt;FONT size=2&gt;(MicroFour.StrataFrame.Data.&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DataLayer&lt;/FONT&gt;&lt;FONT size=2&gt;.DataSources[&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"Aspire"&lt;/FONT&gt;&lt;FONT size=2&gt;].ConnectionString);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;SqlCommand&lt;/FONT&gt;&lt;FONT size=2&gt; cmd = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;SqlCommand&lt;/FONT&gt;&lt;FONT size=2&gt;();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cmd.Connection = cn;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cmd.CommandType = &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;CommandType&lt;/FONT&gt;&lt;FONT size=2&gt;.Text;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;ADUserBO&lt;/FONT&gt;&lt;FONT size=2&gt; mADUser = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;ADUserBO&lt;/FONT&gt;&lt;FONT size=2&gt;();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;SqlParameter&lt;/FONT&gt;&lt;FONT size=2&gt; pDiv = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;SqlParameter&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"@division"&lt;/FONT&gt;&lt;FONT size=2&gt;, mADUser.LocationIndex);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cmd.Parameters.Add(pDiv);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cmd.CommandText = &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"SELECT DISTINCT partdesc FROM PartsMaster WHERE (divisionindex = @division) AND (inactive = 0) ORDER BY partdesc"&lt;/FONT&gt;&lt;FONT size=2&gt;;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;SqlDataAdapter&lt;/FONT&gt;&lt;FONT size=2&gt; sda = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;SqlDataAdapter&lt;/FONT&gt;&lt;FONT size=2&gt;(cmd);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DataSet&lt;/FONT&gt;&lt;FONT size=2&gt; ds = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DataSet&lt;/FONT&gt;&lt;FONT size=2&gt;();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sda.Fill(ds);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;foreach&lt;/FONT&gt;&lt;FONT size=2&gt; (&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DataRow&lt;/FONT&gt;&lt;FONT size=2&gt; dr &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;in&lt;/FONT&gt;&lt;FONT size=2&gt; ds.Tables[0].Rows)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; txtPartDesc.Properties.Items.Add((&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt;)dr[0]);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;Is this the best way to approach a distinct list of strings from my database in order to fill my MRU list?&amp;nbsp; I do have a PartsBO...is there a way to get these strings from the BO?&amp;nbsp; Also, the list is filled in descending alphabetical order, even though I have specified an ASC sort in the query.&amp;nbsp; Is there a reason why my sort is backwards?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;Thanks for any help on this!!&lt;BR&gt;Bill&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Thu, 03 Jul 2008 11:02:59 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: How do I fill an MRU list?</title><link>http://forum.strataframe.net/FindPost17599.aspx</link><description>Cool :cool:</description><pubDate>Thu, 03 Jul 2008 11:02:59 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: How do I fill an MRU list?</title><link>http://forum.strataframe.net/FindPost17598.aspx</link><description>Excellent!&amp;nbsp; That tip just cut my code in half.&amp;nbsp; Lean and mean!&amp;nbsp; :D&lt;/P&gt;&lt;P&gt;Thanks!&lt;BR&gt;Bill</description><pubDate>Thu, 03 Jul 2008 11:00:31 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: How do I fill an MRU list?</title><link>http://forum.strataframe.net/FindPost17596.aspx</link><description>Actually, you really never need to create a connection object.&amp;nbsp; You could reduce your code by just talking straight to the DAL itself:&lt;P&gt;[codesnippet]//-- Establish Locals&lt;BR&gt;SqlCommand cmd;&lt;BR&gt;DataTable results;&lt;/P&gt;&lt;P&gt;//-- Create the command&lt;BR&gt;cmd = new SqlCommand("SELECT DISTINCT partdesc FROM PartsMaster WHERE divisionindex = @division AND inactive = 0 ORDER BY partdesc");&lt;/P&gt;&lt;P&gt;//-- Create the parms&lt;BR&gt;cmd.Parameters.AddWithValue("@division", mADUser.LocationIndex).SqlDbType = System.Data.SqlDbType.Int;&lt;/P&gt;&lt;P&gt;//-- Execute the query and get the results&lt;BR&gt;results = MicroFour.StrataFrame.Data.DataBasics.DataSources[""].GetDataTable(cmd, Nothing);&lt;/P&gt;&lt;P&gt;//-- Now cycle through and populate the combo&lt;BR&gt;foreach (DataRow row in results.Rows)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //-- populate the combo with the row...&lt;BR&gt;}[/codesnippet]</description><pubDate>Thu, 03 Jul 2008 09:58:55 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: How do I fill an MRU list?</title><link>http://forum.strataframe.net/FindPost17594.aspx</link><description>Nice approach.&amp;nbsp; I'll have to digest some of the details a bit.&amp;nbsp; &lt;/P&gt;&lt;P&gt;I only have the one textbox that I have been asked to supply a MRU-type list.&amp;nbsp; The users wanted to pick from all of the decriptions that are on file so that they can be consistent in their naming.&amp;nbsp; What I have provided on this one control works; however, it just seems clumsy to me.&amp;nbsp; Well, I may re-approach this topic if other users start requesting the same thing.&lt;/P&gt;&lt;P&gt;Two last thoughts...1)&amp;nbsp; Could my code be streamlined any?&amp;nbsp; I am not that great at manipulating datasets and collections; and, 2)&amp;nbsp; I'd like to refill this list whenever a record is added/deleted/changed.&amp;nbsp; Code I put the code in the AfterSave() method and it would work for all three operations?&lt;/P&gt;&lt;P&gt;Thanks a ton!&lt;BR&gt;Bill</description><pubDate>Thu, 03 Jul 2008 09:44:24 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: How do I fill an MRU list?</title><link>http://forum.strataframe.net/FindPost17591.aspx</link><description>Glad you got it...we take an entirely different approach to MRUs within our applications.&amp;nbsp; Depending upon where and what are are doing, we may use a combo.&amp;nbsp; But in other cases we use a ListView on a "Getting Started" page.&amp;nbsp; But this really isn't my point on th topic...we actually serialize and store the MRU information on a per user basis in the SQL database itself.&amp;nbsp; This way when a user goes from one machine to the next, their MRUs are still there.&amp;nbsp; Additionaly, we have a single column to query for the user and object state type.&amp;nbsp; We have a MRU base class that we inherit and create for each type of MRU that may need to be created (i.e. patients, codes, templates, etc.)&amp;nbsp; We then serialize the MRU collection to a VarBinary field in an ObjectStates table.&amp;nbsp; So when a user gets to a certain combo/list/whatever, the MRU specifically for them is retrieved and the populates the object in question from the serialized object model.&amp;nbsp; These are just some ideas I thought I would throw out there since you brought up an MRU...this has been a huge hit...especially since it is by user and not specific to a machine.</description><pubDate>Thu, 03 Jul 2008 09:28:33 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: How do I fill an MRU list?</title><link>http://forum.strataframe.net/FindPost17585.aspx</link><description>I got the sort issue sorted out. :)&lt;/P&gt;&lt;P&gt;On the control set the Properties.Sorted = true.&amp;nbsp; Not sure why that is necessary, but it works.</description><pubDate>Thu, 03 Jul 2008 08:29:27 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item></channel></rss>