FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xbrowse and eof
Posts: 434
Joined: Wed Jun 06, 2007 02:58 PM
xbrowse and eof
Posted: Thu Feb 05, 2026 02:40 PM

Hi,
I have this code that read Xbrowse object

function TrovanumeroLotto( oBrw, nLotto )
   local lFound := .F.
   local lEof := .f.

   oBrw:GoTop()

   do while !lEof

  if oBrw:aCols[3]:Value() == nLotto   
     lFound := .T.
	 lEof = .t.
  endif

  oBrw:Skip()
  if oBrw:Eof()
	lEof = .t.
  endif

   enddo
   

return lFound

but when oBrw goes over last row the Obr:Eof() is always false.
Why?

Thanks

FiveWin for xHarbour 24.02 - Feb. 2024 - Embarcadero C++ 7.60 for Win32 Copyright (c) 1993-2023

FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)

Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: xbrowse and eof
Posted: Thu Feb 05, 2026 08:35 PM

Last row = LastRec() ( natural order ) if you press VK_DOWN --Eof() ---> true

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 1054
Joined: Sun Oct 09, 2005 10:41 PM
Re: xbrowse and eof
Posted: Thu Feb 05, 2026 09:00 PM

Prueba asi:

function TrovanumeroLotto( oBrw, nLotto )
 local lFound := .F.
 oBrw:GoTop()
 do while !oBrw:Eof()
     if oBrw:aCols[3]:Value() == nLotto   

         lFound := .T.
     endif
    oBrw:Skip()
 enddo
return lFound

Continue the discussion