You don't need to do a locate or go top before doing a locate for.
>Hello Yousfi,
>
>I try your code like that:
>
>Select FI
> Locate
> Locate For Alltrim(FI.ref) == '2118661'
> If Found()
> SFT.pageframe1.ActivePage=1
> SFT.pageframe1.Page1.Cont1.grid1.SetFocus()
> Else
> Messagebox("not found")
> Endif
>
>
>In fact, the record pointer select the line of my grid where Alltrim(FI.ref) == '2118661', but after that , the record pointer return to the first line in the Grid without making the setfocus on the line with the value i want to locate.
>I presume that is the refresh method on the grid.
>How can solve this?, do i must keep the recno() of the value that i want and after that make a kind of go to recno() ?
>
>Best regards,
>Luis