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

# TCustomStringGrid.InsertRowWithValues

Inserts a row at the specified row position with the specified cell values.

## Declaration

Source position: grids.pas line 1810

`public procedure TCustomStringGrid.InsertRowWithValues(`
`Index: Integer;`
`Values: array of string`
`);`

## Arguments

`Index` |  | Row where the values are inserted.
`Values` |  | Array with string values inserted in the method.

## Description

InsertRowWithValues is a method used to insert a row at the position in Index with the cell content in Values.

InsertRowWithValues examines Values to determine whether the grid has a column for each of the string values. When Values has more entries than columns available in ColCount, new columns are added to the grid. When Columns has been Enabled, the Add method in Columns is called to create any missing column definitions. The title for a column added to the collection is set to an empty string (''). When Columns has not been enabled, the value in ColCount is set to the length of the Values array.

InsertRowWithValues calls InsertColRow to increment the row count for the grid, and assigns each String in Values to the corresponding Cells in the grid control.

Use DeleteRow to remove a row at a specific row number in the grid.