ComponentOne True DBGrid for WinForms
Editing Data
Run-Time Interaction > Database Operations > Editing Data

True DBGrid for WinForms' AllowUpdate property must be True in order for the user to edit data in the grid. The default value is True.

If the user moves to a cell and starts typing, the cell's data will be replaced by what is typed. Alternatively, clicking within the current cell will put the grid into edit mode (its EditActive property becomes True), enabling the user to modify the cell's data.

While editing, the LEFT ARROW and RIGHT ARROW keys move the insertion point within the cell. If the insertion point is at the beginning or end of the cell's text, the LEFT ARROW and RIGHT ARROW keys will terminate editing by moving to the adjacent cell. The UP ARROW and DOWN ARROW keys terminate editing by moving the current cell to the row above or below the current one. The user can also end editing without moving the current cell by pressing the ENTER key.

When one or more cells in a row have been modified, a pencil icon will appear in the record selector column to indicate that data in the row has been changed. The pencil icon does not mean that the grid's EditActive property is True; it means that the grid's DataChanged property is True. To cancel the changes made to the current cell, the user can press the ESC key. In fact, before moving to another row, the user can revisit any column within the current row and press the ESC key to restore the cell to its original value. If the user repeats this procedure for all modified cells in the row, the pencil icon in the record selector will disappear.

Moving to another row by clicking it, using the UP ARROW or DOWN ARROW keys, or by clicking the navigation buttons of the Data control will update the modified record to the database. If the update is successful, the pencil icon will disappear. If no grid columns have been modified, no update will occur when changing rows.

See Also