Hi Malcolm,
I have never had the issue you describe. When I restore the row the grid seems to remember which row it was displaying. I am not replacing the cursor the grid is bound to. I am not sure what would happen if the cursor was replaced.
>Hi James,
>
>Your code successfully restores my previously selected record in a grid. This is the 1st part of a two part question :)
>
>The 2nd part of the question is how to position the selected record at the same relative row within the visible portion of the grid.
>
>VFP's native behavior is to position the re-selected record in the MIDDLE row of the visible grid. I want to position the re-selected record at its ORIGINAL position within the grid. (For sake of simplicity, you can assume that there will always be enough records in the record source ahead of the currently selected record to support this type of positioning)
>
>For example, if I have a grid that displays 10 rows in its visible area and my currently selected record is the 2nd visible row in the grid, when I restore my selected record, I want it to be restored to the 2nd visible row in the grid - NOT the middle of the grid as VFP does by default.
>
>Thanks for taking a stab at this question,
>
>Malcolm
>
>
>>I am not sure if this is what you are looking for but...
>>
>>
>>lnPK = table.pk
>>*refresh grid here
>>locate for table.pk = lnPK
>>if eof()
>> go top
>>endif
>>grid.refresh()
>>