﻿<?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 can I get a list of columns (properties) in BO?</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Sun, 14 Jun 2026 13:09:32 GMT</lastBuildDate><ttl>20</ttl><item><title>How can I get a list of columns (properties) in BO?</title><link>http://forum.strataframe.net/FindPost9292.aspx</link><description>I've looked in the help and can't find a list collection of all the columns/properties that were mapped from table to BO.&lt;br&gt;
&lt;br&gt;
I would like to populate a combobox.Items collection with this list. Can you tell me where I can get this list?&lt;br&gt;
This might be a .Net question, but an answer would help a lot!&lt;br&gt;
&lt;br&gt;
Thanks!</description><pubDate>Wed, 06 Jun 2007 09:48:52 GMT</pubDate><dc:creator>Ben Hayat</dc:creator></item><item><title>RE: How can I get a list of columns (properties) in BO?</title><link>http://forum.strataframe.net/FindPost9359.aspx</link><description>[quote]myCombo.DataSource = myBo.AllFieldsList;[/quote]&lt;br&gt;
&lt;br&gt;
Never thought of that myself! :)</description><pubDate>Wed, 06 Jun 2007 09:48:52 GMT</pubDate><dc:creator>Ben Hayat</dc:creator></item><item><title>RE: How can I get a list of columns (properties) in BO?</title><link>http://forum.strataframe.net/FindPost9350.aspx</link><description>The items collection is special... you can manually add to it, but it's readonly, so you cannot create a new ComboBox.ItemCollection and set it to the value.&amp;nbsp; You can, however, set it as the DataSource of the ComboBox.&lt;/P&gt;&lt;P&gt;myCombo.DataSource&amp;nbsp;= myBo.AllFieldsList;&lt;/P&gt;&lt;P&gt;Should work the way you want it to.&amp;nbsp; If the collection contains complex objects, then you will need to set the DisplayMember and ValueMember properties to tell the ComboBox what property on the complex field to use for each of those, but since your item type is a string, you can just leave the DisplayMember and ValueMember fields blank.</description><pubDate>Wed, 06 Jun 2007 09:06:29 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: How can I get a list of columns (properties) in BO?</title><link>http://forum.strataframe.net/FindPost9316.aspx</link><description>[quote]Also, if you need any of the other collections, you can check out the shared constructor for a business object (located in the designer file) and you can see the collections that are created for each BO class, such as FieldLengths, FieldDbTypes, FieldNativeDbTypes, AllFieldsList, etc.[/quote]&lt;br&gt;
&lt;br&gt;
I just got to see under the hood. Very nice!&lt;br&gt;
&lt;br&gt;
I still don't understand why I couldn't assign from that list to ComBox.Items? In Delphi, I can make that assignment without any problem!</description><pubDate>Tue, 05 Jun 2007 09:48:42 GMT</pubDate><dc:creator>Ben Hayat</dc:creator></item><item><title>RE: How can I get a list of columns (properties) in BO?</title><link>http://forum.strataframe.net/FindPost9314.aspx</link><description>[quote]You shouldn't have to use the ToArray() to do a For Each on the AllFieldsList... it already implements the IEnumerable and IEnumerable&lt;string&gt; interfaces.[/quote]&lt;br&gt;
Ben, I wanted to ask Trent that question why I need to use ToArray().&lt;br&gt;
However, I was trying to get that list, put it into a ComboBox and have the user select the field and I'll do Sort on it. At first I tried to assign BO.AllFieldList to ComboBox.Items and didn't like it and I ended up doing the following way:&lt;br&gt;
&lt;br&gt;
      foreach (string f in storeTaxBO.AllFieldsList.ToArray())&lt;br&gt;
      {&lt;br&gt;
        comboBox1.Items.Add(f);&lt;br&gt;
      }&lt;br&gt;
&lt;br&gt;
How else could I have done this but using ForEach?&lt;br&gt;
Thanks!</description><pubDate>Tue, 05 Jun 2007 09:23:05 GMT</pubDate><dc:creator>Ben Hayat</dc:creator></item><item><title>RE: How can I get a list of columns (properties) in BO?</title><link>http://forum.strataframe.net/FindPost9311.aspx</link><description>You shouldn't have to use the ToArray() to do a For Each on the AllFieldsList... it already implements the IEnumerable and IEnumerable&amp;lt;string&amp;gt; interfaces.&lt;P&gt;Also, if you need any of the other collections, you can check out the shared constructor for a business object (located in the designer file) and you can see the collections that are created for each BO class, such as FieldLengths, FieldDbTypes, FieldNativeDbTypes, AllFieldsList, etc.</description><pubDate>Tue, 05 Jun 2007 08:26:41 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: How can I get a list of columns (properties) in BO?</title><link>http://forum.strataframe.net/FindPost9305.aspx</link><description>Thanks Trent;&lt;br&gt;
&lt;br&gt;
I'm glad you gave me that code snippet. I'd have missed the "ToArrey" method!</description><pubDate>Mon, 04 Jun 2007 20:43:25 GMT</pubDate><dc:creator>Ben Hayat</dc:creator></item><item><title>RE: How can I get a list of columns (properties) in BO?</title><link>http://forum.strataframe.net/FindPost9303.aspx</link><description>A BO has a property called AllFIeldsList that contains all of the fields that belong to the BO.&amp;nbsp; You can enumerate it like this:&lt;/P&gt;&lt;P&gt;[codesnippet]'-- Establish Locals&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim lcAllFields As String = ""&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; For Each lcField As String In Me.MyBO.AllFieldsList.ToArray()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lcAllFields &amp;amp;= lcField &amp;amp; ControlChars.CrLf&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox(lcAllFields)[/codesnippet]</description><pubDate>Mon, 04 Jun 2007 20:29:29 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: How can I get a list of columns (properties) in BO?</title><link>http://forum.strataframe.net/FindPost9294.aspx</link><description>never mind the last bracket, cut &amp; paste mistake!</description><pubDate>Mon, 04 Jun 2007 15:43:30 GMT</pubDate><dc:creator>Ben Hayat</dc:creator></item><item><title>RE: How can I get a list of columns (properties) in BO?</title><link>http://forum.strataframe.net/FindPost9293.aspx</link><description>Ok, there is a list property Fieldnames of each BO.&lt;br&gt;
&lt;br&gt;
I tried to iterate through it but no luck:&lt;br&gt;
[quote]      foreach (string f in BO.StoreBO.StoreBOFieldNames)&lt;br&gt;
      {&lt;br&gt;
        comboBox1.Items.Add(f);&lt;br&gt;
      }&lt;br&gt;
    }[/quote]</description><pubDate>Mon, 04 Jun 2007 15:42:21 GMT</pubDate><dc:creator>Ben Hayat</dc:creator></item></channel></rss>