I hope this works :
with thisformset.FCompany.Egridsrpricat
lnRows = floor((.height - .headerheight - sysmetric(8))/.rowheight)
for ix=1 to lnRows
.DoScroll(0)
endfor
.Setfocus()
endwith
Cetin
>Cetin,
>
>The scenario is the grid is 4 rows and there are 4 rows in the table.
>The grid currently displays rows 1-4. I click on the last row in the grid and then click on a command button somewhere else on the same form. This button invokes another form in the formset where the user edits the one row. The 'OK' button on the 2nd form does the code below. When the grid is redisplayed the only row visible is the 4th row which is at the top of the grid as if it is the only row and manual scrolling is necessary to see rows 1-3.
>If more or less rows are in the table or another row is selected for editing the code below displays the rows correctly.
>TIA.
>
>thisform.VISIBLE=.F.
>thisformset.FCompany.Egridsrpricat.doscroll(2)
>thisformset.FCompany.Egridsrpricat.doscroll(3)
>thisformset.FCompany.Egridsrpricat.setfocus()
>thisformset.FCompany.refresh()
>thisformset.FCompany.visible = .T.