>>>>>>For design-time see
>>>>>>
Re: Changing grid's RowSource in Design-time Thread #
674623 Message #
674846>>>>>>
>>>>>>And I just found that I forgot to add attribution in my code and was trying to find this thread by different name. Shame on me.
>>>>>>
>>>>>>For run-time I either use safe select approach or CA with CursorRefresh()
>>>>>
>>>>>Thanks, Naomi, but there;'s a simpler soln. I'm after
>>>>
>>>>What can be simpler than zapping a cursor and appending into it from the temp one?
>>>
>>>This:
>>>
>>>thisform.grid.recordsource = ""
>>>
>>>* Create new cursor...
>>>
>>>thisform.grid.recordsource = cursor
>>
>>And then you have to add a ton of code to get the grid to behave like it used to do? No this is NOT the way, Terry. But this is:
>>
>>Select whatever into cursor curtemp
>>Select Gridcursor
>>zap
>>appe from dbf('curtemp')
>>yourgrid.refresh()
>
>Thanks Tore
>
>This has raised some intersting issues:
>
>1. The initial dummy select - doesn't that belong in a different method? Otherwise it would be getting created again, anyway, every time you call the method to refresh the grid with the newly selected data?
>
>2. You talk about the extra code necessary (presumably to "shape" the grid.) but where does the grid formatting, and field-to-grid column allocation happen, if you don't select the data in the order in which it should appear on the grid.
>AFAIC see, you have to do that anyway.
>
>Terry
First of all, this discussion is maybe irrelevant if you always create the grid "on the fly". Personally I usually create grids from a temporary table with the same name as the cursor I create in the application, and I do it visually in the form designer. This also mean that I usually move some fields, resize them, and so on.
1. Yes, persoanlly I have code like "Select * from myfile where .F. into cursor mydummy readwrite" in the form's load event, so that I have a cursor to bind the grid to.
2. As mentioned, I do that in the form designer. Some of my grids are very complex, with many calculated fields and so on.