﻿<?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?)  » Binding an Enhanced List at runtime</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Wed, 16 Sep 2026 19:44:57 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Binding an Enhanced List at runtime</title><link>http://forum.strataframe.net/FindPost14797.aspx</link><description>[quote]How do you set up MethodToExecute if there is no parameter for the method being called?[/quote]&lt;/P&gt;&lt;P&gt;Is that a trick question? :)&amp;nbsp; You just leave off the parameters:&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;[codesnippet]Me.grdHdr.PopulationDataSourceSettings.MethodToExecute = "FillDataTable;"[/codesnippet]&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;&lt;/FONT&gt;</description><pubDate>Tue, 11 Mar 2008 13:08:52 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>Binding an Enhanced List at runtime</title><link>http://forum.strataframe.net/FindPost1504.aspx</link><description>I'm trying to use a generic form to maintain several different tables in the database.&amp;nbsp; They all use the same form, but just different data sources.&amp;nbsp; What is the best way to do this in code at run-time&amp;nbsp;instead of&amp;nbsp;setting it through the designer at design time?&amp;nbsp; I figure I need to set some properties of the PopulationDataSourceSettings, but what I'm doing hasn't been working.&amp;nbsp; Here's the code I've got so far to bind the grid, and maybe someone can tell me what I have missing.&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;P&gt;Public&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Class&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt; frmSFTableBase&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp; Public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/FONT&gt;&lt;FONT size=2&gt; &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=#0000ff size=2&gt;ByVal&lt;/FONT&gt;&lt;FONT size=2&gt; HdrBO &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; BusinessLayer, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ByVal&lt;/FONT&gt;&lt;FONT size=2&gt; HdrValue &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;String&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me&lt;/FONT&gt;&lt;FONT size=2&gt;.BusinessObjects.Add(HdrBO)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.grdHdr.PopulationDataSourceSettings.BusinessObjectType = &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"BBS.Biz.BizTypeBO"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.grdHdr.PopulationDataSourceSettings.ValueMember = HdrValue&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.grdHdr.PopulationDataSourceSettings.MethodToExecute = &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"FillDataTable()" &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.grdHdr.PopulationDataSourceSettings.DisplayFieldNames.Add(HdrValue&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me&lt;/FONT&gt;&lt;FONT size=2&gt;.grdHdr.PopulationDataSourceSettings.FormatColumns.Add(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"{0}"&lt;/FONT&gt;&lt;FONT size=2&gt;, MicroFour.StrataFrame.UI.ListViewColumnPopulationType.FormattedString)&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me&lt;/FONT&gt;&lt;FONT size=2&gt;.InitializeComponent()&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp; Private&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/FONT&gt;&lt;FONT size=2&gt; grdHdr_ListPopulating(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ByVal&lt;/FONT&gt;&lt;FONT size=2&gt; e &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp; MicroFour.StrataFrame.UI.ListPopulatingEventArgs) &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Handles&lt;/FONT&gt;&lt;FONT size=2&gt; grdHdr.ListPopulating&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.Parameters(0).Value = &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"SELECT * FROM BizType"&lt;BR&gt;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/P&gt;&lt;/FONT&gt;&lt;P&gt;End Class</description><pubDate>Tue, 11 Mar 2008 13:08:52 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item><item><title>RE: Binding an Enhanced List at runtime</title><link>http://forum.strataframe.net/FindPost14795.aspx</link><description>Guys,&lt;/P&gt;&lt;P&gt;How do you set up MethodToExecute if there is no parameter for the method being called?&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;Geoff Hirst</description><pubDate>Tue, 11 Mar 2008 12:13:46 GMT</pubDate><dc:creator>Geoff Hirst</dc:creator></item><item><title>RE: Binding an Enhanced List at runtime</title><link>http://forum.strataframe.net/FindPost1513.aspx</link><description>Yes, this is what we normally do as well.&amp;nbsp; Glad you got going.&amp;nbsp;</description><pubDate>Mon, 12 Jun 2006 16:35:09 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Binding an Enhanced List at runtime</title><link>http://forum.strataframe.net/FindPost1508.aspx</link><description>Ok, it looks like you have to populate a ListViewPopulationSettings object and then set it the listview property.&amp;nbsp; This now works for me:&lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;PopSettings.BusinessObjectType = &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"BBS.Biz."&lt;/FONT&gt;&lt;FONT size=2&gt; &amp;amp; HdrValue &amp;amp; &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"BO"&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;PopSettings.DisplayFieldNames.Add(HdrValue)&lt;BR&gt;PopSettings.FormatColumns.Add(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"{0}"&lt;/FONT&gt;&lt;FONT size=2&gt;, MicroFour.StrataFrame.UI.ListViewColumnPopulationType.FormattedString)&lt;BR&gt;PopSettings.FormatString = &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"{0}"&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;PopSettings.MethodToExecute = &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"FillDataTable;System.String"&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;PopSettings.ValueMember = HdrValue&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.grdHdr.PopulationDataSourceSettings = PopSettings&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Mon, 12 Jun 2006 13:08:51 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item><item><title>RE: Binding an Enhanced List at runtime</title><link>http://forum.strataframe.net/FindPost1507.aspx</link><description>Oh, and my grid is actually the Enhanced List control from the DevX wrapper classes.&amp;nbsp; Forgot to say that I think.</description><pubDate>Mon, 12 Jun 2006 11:28:21 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item><item><title>RE: Binding an Enhanced List at runtime</title><link>http://forum.strataframe.net/FindPost1506.aspx</link><description>Ok, I now have this:&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;P&gt;Me&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;.grdHdr.PopulationDataSourceSettings.BusinessObjectType = &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"BBS.Biz."&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &amp;amp; HdrValue &amp;amp; &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"BO"&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.grdHdr.PopulationDataSourceSettings.DisplayFieldNames.AddRange(&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=#0000ff size=2&gt;String&lt;/FONT&gt;&lt;FONT size=2&gt;() {HdrValue})&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.grdHdr.PopulationDataSourceSettings.FormatColumns.Add(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"{0}"&lt;/FONT&gt;&lt;FONT size=2&gt;, MicroFour.StrataFrame.UI.ListViewColumnPopulationType.FormattedString)&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.grdHdr.PopulationDataSourceSettings.FormatString = &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"{0}"&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.grdHdr.PopulationDataSourceSettings.MethodToExecute = &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"FillDataTable;System.String"&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.grdHdr.PopulationDataSourceSettings.ValueMember = HdrValue&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;But on the first line it gives me an exception and the message on Me.grdHdr is "Object cannot be null".&amp;nbsp; It looks like for some reason my grid is Nothing, but I created it on the form at design time so what else do I need to do to have an instance of it?&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Mon, 12 Jun 2006 11:24:46 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item><item><title>RE: Binding an Enhanced List at runtime</title><link>http://forum.strataframe.net/FindPost1505.aspx</link><description>You can set the properties of the EnhancedList at runtime, but you would probably be best served to create PopulationDataSourceSettings at design-time and then copying the code from the InitializeComponent method.&amp;nbsp; You're missing a few things when you're configuring them at runtime.&lt;/P&gt;&lt;P&gt;The MethodToExecute is a semi-colon-separated list of the method name and parameters... in this case, it would be "FillDataTable;System.String".&amp;nbsp; When we use the same list and populate it with several different data sets, we will set the PopulationDataSourceSettings manually within the code.&amp;nbsp; Other than that, your ListPopulating method is correct, but you'll need to call the Requery() method whenever you want to repopulate the list.</description><pubDate>Mon, 12 Jun 2006 10:46:32 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item></channel></rss>