I don't like to have custom methods of grid itself. You know, grid is too unstable thing, it loses its settings too often. Moreover, I don't like to subclass grid. I prefer to define grid as part of form or container. Form/container itself could be a class, but this is different story.
In regard to column issue. I didn't read other messages in this thread, so I will make some assumptions. Basically, grid settings includes as main part of it, setting of controlsources for each column, therefore having some object (custom) on form that will re-code these controlsources will do it. I have some classes to accomodate the cases when user make free-style queries (i mean random fields, criteria etc) and the result goes to the same grid.
>OK Ed.... And I am going to be civil here... This is my big test....
>
>Tell me which is a better approach:
>
>1. Having the code in the Init() or...
>2. Having a custom method of the Grid and having it called by the Init()
>
>I know it sounds like semantics, but it makes for a more flexible design... I have never been a fan of calling things like Init(). The Init() is an event, that should call other method code. Once again, it is more of a design thing....
>
>Now, with regard to persisting the code, I see where you are going here... In cases where the column makeup of the grid can differ, I would also go with this approach. However, I would probably use separate classes for each behavior, and have the grid create an instance of the correct behavior class. Kind of like a chain of responsibility deal here.
>
>However, in cases where the columns are the same, only the data differs - I think Jeff Pace had the best idea - use a parameterized view.... Then, you don't need to tweak grid.
>
>In cases where you deal with physically different cursors, which we do with our SQL Server DataClas2000 stuff, using a place holder cursor before swapping out the cursors works just fine... i.e. no code is required, other than to deal with the recordsource stuff.....
>
>Your thoughts????
>
>
>>It depends how safe you're toggling it. Normally, it's not like Grid.Recordsource='something' etc. The good way is to make important grid settings in code (in Grid.Init event) and call it right away:
>>Thisform.MyGrid.Init
>>anytime you fell necessity to wake up your grid.
>>
>>>Not good advice Ed...
>>>
>>>Just toggling the recordsource usually leads to undesireable results - i.e. - the grid attributes are lost....
>>>
>>>>Usually, grids that don't display get fixed by toggling their recordsource. Did you try that?
Edward Pikman
Independent Consultant