Version

DeallocateCells Method (RowsCollection)

Releases allocated cell objects. Cells are allocated lazily as they are accessed. This method is for releasing cells that have been allocated so for.
Syntax
'Declaration
 
Public Sub DeallocateCells( _
   ByVal recursive As Boolean _
) 
public void DeallocateCells( 
   bool recursive
)

Parameters

recursive
If true then clears the cells of the descendant rows as well.
Remarks

Cells are lazily allocated. They are allocated as they are accessed. However once a cell is allocated, it remains referenced until the row is removed. You can use this method to release references to the cells that have been allocated. Note that they will be re-allocated when they are accessed next time.

One use for this method is to reset all the cells to their default settings. For example, if you have set some settings on the cells of a row and you want to clear all those settings then you can use this method to simply clear the cell collection. This will have the same effect as having reset all the cells of the row with one added benefit that the references to the cells will have been released and thus may result in improved memory usage. Note that the cells will be re-allocated when they are accessed the next time. This method is exposed on the UltraGridRow as well so this operation can be performed on an individual row as well.

Note: If one of the cells of this row is the current active cell or is selected then it will not be cleared from the collection as the ActiveCell property of the grid (or the SelectedCellsCollection in the case of selected cells) is holding reference to the cell. Such cells will not be cleared. They will remain part of the cell collection. However their settings will be reset. In other words, the end result will be the same.

Note that any references to the cells from this row after ClearCells call should be considered invalid (except for the active cell and selected cells as noted above). Also the cell collection itself is released, which is also lazily allocated.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also