Hi
ActiveRow returns zero if the grid doesn't have the focus or when you access a row outside the grid display.
If you code in DeleteButton.Click() - then grid lost focus and focus go to DeleteButton and ActiveRow change value to 0.
ActiveRow is not 0 just within Grid object
Denis
>Scenario: oForm.Pageframe.Page1.DeleteButton.Click
>
>This code produces error 52 in line 3, no table open in current work area
>
>
>SELECT MyTable
>THIS.PARENT._grid1.SETFOCUS
> IF THIS.PARENT._grid1.ActiveRow <> 0
> DELETE
> THIS.PARENT._grid1.REFRESH
> ENDIF
>
>
>So I tried
>
>
>SELECT MyTable
>TRY
> THIS.PARENT._grid1.SETFOCUS
> IF THIS.PARENT._grid1.nActiveRow <> 0
> DELETE
> THIS.PARENT._grid1.REFRESH
> ENDIF
>CATCH TO oException
>ENDTRY
>
>
>This does not produce an error, but on the other hand nothing happens, because the activerow is always zero.
>
>Why the grid has to have the focus in order to determine the activerow is quite beyond me, but that's another matter.
>
>It does make one wonder how the people who developed Excel, overcame this obstacle, and why this knowledge was not passed on to the VFP team.
>
>
>TIA