General information
Category:
Forms & Form designer
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?
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only