Oops, meant to copy you, but going back and forth through preview - which I did a few times - causes the choices for who to copy to be lost and I didn't notice that . . .
>This is a candidate for using an _Access method. I created a grid property called NumberOfVisibleRowsWithData (yes, I know this depletes the number of letters available for use in the world, but I decided to throw caution to the wind). I set it up with an _Access method. The _Access method follows:
>
>
>*NumberOfVisibleRowsWithData_Access method
>local OrigPropSetting
>
>private RowsData
>RowsData = 0
>
>thisform.LockScreen = .t.
>
>with this.Columns(1)
> OrigPropSetting = .DynamicFontShadow
> .DynamicFontShadow = "_VFP.SetVar('RowsData', m.RowsData + 1)"
> this.Refresh
> .DynamicFontShadow = OrigPropSetting
>endwith
>
>this.NumberOfVisibleRowsWithData = m.RowsData
>
>thisform.LockScreen = .f.
>
>return m.RowsData
>
>
>Now, all I have to do is:
>
>WAIT WINDOW TRANSFORM(oGridName.NumberOfVisibleRowsWithData) NOWAIT
>
>or access the NumberOfVisibleRowsWithData property in some other fashion and the count is updated automatically.
>
>As an improvement, I'm wondering about using the NumberOfVisibleRowsWithData_Assign method. If you could get it working so that the NumberOfVisibleRowsWithData property is the one being incremented (instead of RowsData), the the NumberOfVisibleRowsWithData_Assign method would be called. In that method, you'd have the potential to increment the NumberOfVisibleRowsWithData property on a conditional basis (for instance, if the row truly had data in order to avoid counting rows that were empty, which I believe this code will do). Anyway, that's for another day, I suppose. (But feel free to offer up some code to accomplish that goal. <g>)
>
>>I use grids extensively. They are great for line item data entry (invoice line items, sales order line items, etc.). They more closely simulate the paper-based forms people are used to and make quick work of entering line items (as opposed to a technique some here have espoused that makes the user do the editing for a line item in a separate form, which means opening and closing and opening and closing this form all the time). Not using the grid implies VFP can't handle a common task that other languages handle well. That's simply not true. I've always found the grid does what I need it to do for my customers and I don't feel I'm compromising. Sure, there are other grids that do more, but it's like all the tons of features in Word - you really don't use most of them most of the time. And now Fabio has demonstrated via his sample code what we all should know . . . with VFP there's always a way. He has given you a great solution to your question and it can be incorporated into
>>your grid class.
>>
>>>I can't do that.
>>>I must use SET DATASESSION for that to access that alias in that (first) form.
>>>If I do that then in second form (from which I want to do scroll) grid losses data.
>>>Damn grids :) Worst control in VFP.
>>>
>>>>Just do a GO BOTTOM on the alias.
>>>>
>>>>>With alias.
>>>>>I am asking that because I need to just do scroll to last row from another form.