﻿<?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 » Issues  » The Do - Loop While BO.MoveNext does not cycle through all of the records</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Sat, 18 Apr 2026 06:37:30 GMT</lastBuildDate><ttl>20</ttl><item><title>The Do - Loop While BO.MoveNext does not cycle through all of the records</title><link>http://forum.strataframe.net/FindPost18141.aspx</link><description>&amp;nbsp;Hi SF Team,&lt;P&gt;Below is an example of some logic I am using in my app and found it was not&amp;nbsp;cycling through all&amp;nbsp;of the records.&amp;nbsp;&amp;nbsp;&amp;nbsp; Unless I execute the BO.MoveFirst() method before the do loop,&amp;nbsp;&amp;nbsp;it does not cycle through all of the records&amp;nbsp;&lt;IMG title=Crazy src="http://forum.strataframe.net/Skins/Classic/Images/MessageIcons/Crazy.gif" align=absMiddle&gt;.&amp;nbsp;&amp;nbsp; Why do I have to execute the .MoveFirst method to use this logic?&amp;nbsp;&amp;nbsp; Would it be better to use .GetEnumerable method of the BO instead?&lt;/P&gt;&lt;P&gt;Thanks Guys,&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Using&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; lo &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;As&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;New&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; DepartmentsBO&lt;/P&gt;&lt;P&gt;lo.FillDataTable(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;&lt;FONT color=#800000 size=2&gt;"SELECT * FROM CMPRDepartments"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;lo.MoveFirst()&lt;/P&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;Do&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;Debug.Print(count &amp;amp; &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;&lt;FONT color=#800000 size=2&gt;" - Department = "&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &amp;amp; lo.DepartmentDescription)&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Loop&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;While&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; lo.MoveNext&lt;/P&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;Using&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description><pubDate>Tue, 29 Jul 2008 10:03:15 GMT</pubDate><dc:creator>Jeff Pagley</dc:creator></item><item><title>RE: The Do - Loop While BO.MoveNext does not cycle through all of the records</title><link>http://forum.strataframe.net/FindPost18185.aspx</link><description>Hi Peter,&lt;/P&gt;&lt;P&gt;You are absolutely right.&amp;nbsp; I am&amp;nbsp;now to using GetEnumerable and I am refactoring&amp;nbsp;all of the old code.&lt;/P&gt;&lt;P&gt;Thanks, Jeff</description><pubDate>Tue, 29 Jul 2008 10:03:15 GMT</pubDate><dc:creator>Jeff Pagley</dc:creator></item><item><title>RE: The Do - Loop While BO.MoveNext does not cycle through all of the records</title><link>http://forum.strataframe.net/FindPost18182.aspx</link><description>Hi Jeff,&lt;/P&gt;&lt;P&gt;We just use GetEnumerable once we found out about it and refactored all old code. Prior to that we did (without any problems):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If BO.MoveFirst() Then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Do&lt;/P&gt;&lt;P&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Loop While BO.&lt;FONT style="BACKGROUND-COLOR: #3399ff" color=#ffffff&gt;MoveNext&lt;/FONT&gt;()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;BR&gt;&lt;/P&gt;&lt;P&gt;This code is better as I believe your example will error if the BO is empty on the MoveFirst.&lt;/P&gt;&lt;P&gt;Cheers, Peter</description><pubDate>Tue, 29 Jul 2008 09:48:00 GMT</pubDate><dc:creator>Peter Jones</dc:creator></item><item><title>RE: The Do - Loop While BO.MoveNext does not cycle through all of the records</title><link>http://forum.strataframe.net/FindPost18147.aspx</link><description>I'm not sure about why you have use MoveFirst(), but I've run into this before, on a freshly filled BO.  In any case, GetEnumerable() is the better choice.  It will cycle through all the rows and it makes sure the current index is restored when done.&lt;br&gt;</description><pubDate>Mon, 28 Jul 2008 15:55:48 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: The Do - Loop While BO.MoveNext does not cycle through all of the records</title><link>http://forum.strataframe.net/FindPost18145.aspx</link><description>That is correct, but you should really be using the GetEnumerable if you don't want to worry about the MoveFirst:&lt;/P&gt;&lt;P&gt;[codesnippet]For Each bo As MyBO in MyBOInstance.GetEnumerable()&lt;BR&gt;&amp;nbsp;&amp;nbsp; '---&lt;BR&gt;Next[/codesnippet]</description><pubDate>Mon, 28 Jul 2008 15:54:36 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>