Wiki Home

Vfe Loops

Namespace: VFP
Q: How do I iterate through all the items of Business Object?
A: Not DO while !this.eof()

VFE's go_first/go_next looping is slightly different than you might expect. Navigate("NEXT") does not ever get get to eof - it stops on the last record, and returns FILE_EOF, but because it is on the last record (not eof), this.eof() returns .f.

local ;

With This
  lnGoOn = .Navigate("FIRST") 
  Do While lnGoOn = FILE_OK

    * Put Loopy code here

    lnGoOn = .Navigate("NEXT") 

!!! This doens't work!!!! .Navigate("FIRST") always returns FILE_BOF, so lnGoOn will never be FILE_OK, so the loop never executes. Opps! - ?CFK

Contribtors: Carl Karsten
Category Visual FoxExpress
( Topic last updated: 2001.11.13 11:13:43 AM )