﻿<?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?)  » Iterate through a Buismess Object</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Sun, 13 Sep 2026 21:15:30 GMT</lastBuildDate><ttl>20</ttl><item><title>Iterate through a Buismess Object</title><link>http://forum.strataframe.net/FindPost27743.aspx</link><description>I am trying to set up a piece of code just to loop through a BO. Took the code below from training class manual but &amp;nbsp;cant get intellisense on BoType&lt;P&gt;[codesnippet]foreach&amp;nbsp; (BoType bo in myBo,GetEnumerable() )&lt;BR&gt;{ MessageBox.Show(.....); }[/codesnippet]</description><pubDate>Wed, 28 Jul 2010 09:33:19 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: Iterate through a Buismess Object</title><link>http://forum.strataframe.net/FindPost27768.aspx</link><description>Hi Gerard,&lt;br&gt;
&lt;br&gt;
Glad it is working for you. :P&lt;br&gt;
&lt;br&gt;
I've been there many times when the .GetEnumerable() was introduced by Trent 2 years ago and I was fairly new to all .Net, but now I use this all over, it is easy, fast and reliable since it will not affect the actual CurrentRowIndex of the BO instance in the form.</description><pubDate>Wed, 28 Jul 2010 09:33:19 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Iterate through a Buismess Object</title><link>http://forum.strataframe.net/FindPost27767.aspx</link><description>Hi Edhy. Thanks for that. I did not see that is was the Business Object as opposed to the instantiated Business Object that goes with the Foreach. Its compiling now.&lt;/P&gt;&lt;P&gt;regards, Gerard</description><pubDate>Wed, 28 Jul 2010 02:57:20 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: Iterate through a Buismess Object</title><link>http://forum.strataframe.net/FindPost27764.aspx</link><description>Hi Gerard,&lt;br&gt;
&lt;br&gt;
It should be:&lt;br&gt;
&lt;br&gt;
[codesnippet]foreach ([b]ideBO[/b] boRow in this.ideBO1.GetEnumerable())&lt;br&gt;
{ MessageBox.Show(ideBO1.IDE_STKREF); }[/codesnippet]</description><pubDate>Tue, 27 Jul 2010 17:12:27 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Iterate through a Buismess Object</title><link>http://forum.strataframe.net/FindPost27761.aspx</link><description>Edhy and greg..many thanks for your replies.&lt;P&gt;I am getting a ...ideBo1 is a field but is used as a type compile error message. ideBo1 is an instance of the BO on the form and is fine in all other processing.&amp;nbsp; Must be something very simple but I cant see it ??&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;P&gt;[codesnippet]foreach (ideBO1 boRow in this.ideBO1.GetEnumerable())&lt;BR&gt;{ MessageBox.Show(ideBO1.IDE_STKREF); }[/codesnippet]&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Tue, 27 Jul 2010 16:02:20 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: Iterate through a Buismess Object</title><link>http://forum.strataframe.net/FindPost27750.aspx</link><description>Edhy right on the money, as usual. ;)&lt;br&gt;
&lt;br&gt;
Here is the C# code you might use. &lt;br&gt;
&lt;br&gt;
Sample #1: Looping through a BO dropped on a form. Assume you have a BO you've built called MySpecialBO. You've dropped an instance on a form and the instance is named MySpecialBO1.  &lt;br&gt;
[codesnippet]foreach(MySpecialBO boRow in this.MySpecialBO1.GetEnumerable())&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;//-- Do something with boRow. Each loop will move it to next row in data table,&lt;br&gt;
&amp;nbsp;&amp;nbsp;//&amp;nbsp;&amp;nbsp;&amp;nbsp;only you can use the strongly typed properties to access data.&lt;br&gt;
}[/codesnippet] &lt;br&gt;
&lt;br&gt;
Sample #2: Looping through the BO within the BO itself. We'll use MySpecialBO again, but this time we're doing this inside an instance method.&lt;br&gt;
[codesnippet]foreach(MySpecialBO boRow in this.GetEnumerable())&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;//-- Do something with boRow. Each loop will move it to next row in data table,&lt;br&gt;
&amp;nbsp;&amp;nbsp;//&amp;nbsp;&amp;nbsp;&amp;nbsp;only you can use the strongly typed properties to access data.&lt;br&gt;
}[/codesnippet]</description><pubDate>Tue, 27 Jul 2010 14:02:54 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Iterate through a Buismess Object</title><link>http://forum.strataframe.net/FindPost27744.aspx</link><description>Hi Gerald,&lt;br&gt;
&lt;br&gt;
This is something I use a lot :) Here is the vb version:&lt;br&gt;
[codesnippet]&lt;br&gt;
 For Each [b]record [/b]As bizTransactionItems In [b]Me.BizTransactionItems1[/b].GetEnumerable()&lt;br&gt;
                                    record.QBInvoiceRefID = .RefId&lt;br&gt;
                                    record.QBInvoiceNumber = .RefNumber&lt;br&gt;
                                Next record&lt;br&gt;
[/codesnippet]&lt;br&gt;
&lt;br&gt;
Where "record" is the object based on the main class of the business object, not the instance in the form. and Me.BizTransactionItems1 is the instance class in the form.  Whatever you do with "record" it is actually happening in Me.BizTransactionItems1 real time, except that GetEnumerable() will keep the record pointer "CurrentRowIndex" updated for you, so don't need to worry about it. :w00t:&lt;br&gt;
&lt;br&gt;
Enjoy!!!!</description><pubDate>Tue, 27 Jul 2010 12:58:14 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item></channel></rss>