Choosing a Grid Type
OBJECTIVE GRID FOR .NET includes several types of grids:
- Regular Grid — You fill the grid with data at startup. The user can edit cells. Changes are stored in the grid.
- Virtual Grid — You maintain the data to be displayed in the grid using a data structure or an external file. The grid generally does not store cell contents in memory. You do not fill the grid at startup. Instead, you handle the
GetStyleRowColevent to supply data on demand. Before it draws the cells on the screen, Grid .NET raises theGetStyleRowColevent only for the currently visible cells. If you want the user to be able to edit cells, you need to handle theStoreStyleRowColevent and store the changes back into your custom data source. Grid .NET invokes theStoreStyleRowColevent whenever a cell is changed. For more information, see Chapter 4 Virtual Grids - Formula Grid —You enable the formula engine and fill the grid with data at startup. Cells can contain formulas that reference other cells. When the user edits cells, changes are stored in the formula engine. If a cell that is referenced by a formula is changed, the referring cell is automatically updated.
These guidelines will help you decide what kind of grid to use:
- Do you need formula support?
- Does your grid have a large number of rows?
- Do you want the grid to directly operate on your data?
- Do you want to copy the data into your grid?
Use a Formula Grid.
Use a Virtual Grid.
Use Virtual Grid. You do not have to copy all the data at startup into the grid.
Use Regular Grid. At startup you fill the grid with your data. The 1stGrid tutorial demonstrates this kind of grid.