xbrowse and eof

Post Reply
User avatar
damianodec
Posts: 434
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia
Been thanked: 1 time
Contact:

xbrowse and eof

Post by damianodec »

Hi,
I have this code that read Xbrowse object

Code: Select all | Expand

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)
User avatar
cnavarro
Posts: 6763
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Has thanked: 30 times
Been thanked: 24 times

Re: xbrowse and eof

Post by cnavarro »

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
User avatar
Willi Quintana
Posts: 1070
Joined: Sun Oct 09, 2005 10:41 pm
Location: Cusco - Perú
Been thanked: 9 times
Contact:

Re: xbrowse and eof

Post by Willi Quintana »

Prueba asi:

Code: Select all | Expand

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
Post Reply