Jump to content


Photo

Sharing code between multiple girds.


  • Please log in to reply
No replies to this topic

#1 nosx

nosx
  • Members
  • 11 posts

Posted 26 August 2014 - 07:31 AM

I am working on an application that has 7 grids on it laid out in tabs. I do alot of the same actions to each of these grids often like deleting rows, Adding new news etc.. What I want to do is create a ActionList Action whereby I can simply call the action and it will know which grid I am currenly focused on and then preform the action on the gird that is selected. I want to do this without the need to write CASE statements or a bunch if If statements and infact I don't even want to ever call the grids by their names in the code at all, but rather a generic Class name that works for all grids in the application. is this possible?

To put it another way I want to eliminate the need to write my code like this

ShowMessage(NextGrid1.Cells[1,1]);

where I have to specify the name of the grid everytime and instead I want to create an action something like this

ShowMessage(CurrentlyFocusedGrid.Cells[1,1]);

and it will show the contents of Cell 1,1 for whatever gird I have focused at the time.

The point of this is to cut down on redundent code so it's easier to maintain and requires I only write the code once for all the grids I have in my application be it 2 or 200.

TIA,
Nosx




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users