[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Grids' (#lcl)

# TCustomDrawGrid.MoveColRow

Moves a column or a row from a specified position to a new position in the grid.

## Declaration

Source position: grids.pas line 1459

`public procedure TCustomDrawGrid.MoveColRow(`
`IsColumn: Boolean;`
`FromIndex: Integer;`
`ToIndex: Integer`
`);`

## Arguments

`IsColumn` |  | True when a column is moved in the method.
`FromIndex` |  | Position for the column or row moved in the moved.
`ToIndex` |  | New position where the column or row is stored.

## Description

Implemented using the DoOPMoveColRow method.

Values in FromIndex and ToIndex must be valid column or row numbers for the control. An EGridException is raised if either value is not valid.

No actions are performed in the method if FromIndex and ToIndex have the same value.

No actions are performed in the method if IsColumn is True and columns are locked using the GridFlags. This occurs when a column index is being updated in the control.

Calls ColRowMoved to perform a notification when the column or row has been moved.

Calls VisualChange if the Columns collection has not been enabled in the control, or when IsColumn is False.

Updates the bounds for the cell editor when it is located in a column or row affected in the method.

Updates the value in SortColumn if it is affected in the method.