# Locking Cell from Being Edited

## Content



You may want to prevent the end user from editing the data in particular cells. If you choose, you can lock individual grid cells from being edited at run time by using the [FetchCellStyle](/componentone/docs/win/online-truedbgrid/) event.

To lock the value in cell (1, 0), complete the following steps:

1.  Set the [FetchStyle](/componentone/docs/win/online-truedbgrid/) property of the column containing the cell to **True**.
    
    **In the Designer**
    
    *   Open the **C1TrueDBGrid Designer**. For information on how to access the **C1TrueDBGrid Designer**, see Accessing the [C1TrueDBGrid Designer](/componentone/docs/win/online-truedbgrid/design-time/truedbgrid-designer).
    *   Select the _First_ column by clicking on its column header in the right pane.<br />Alternatively, it can also be selected from the drop-down list in the toolbar.
    *   Click the **Display Columns** tab in the left pane.
    *   Set the [FetchStyle](/componentone/docs/win/online-truedbgrid/) property to **True**.
    *   Click **OK** to close the designer.
    
    **In Code**
    
    Add the following code to the **Form\_Load** event:
    
    ```csharp
    this.c1TrueDBGrid1.Splits[0].DisplayColumns[0].FetchStyle = true;
    ```
    
2.  Set the [Locked](/componentone/docs/win/online-truedbgrid/) property of the [CellStyle](/componentone/docs/win/online-truedbgrid/) object to **True** only for the value in row one:
    
    ```csharp
    private void C1TrueDBGrid1_FetchCellStyle(object sender, C1.Win.C1TrueDBGrid.FetchCellStyleEventArgs e)
    {
        if (e.Row == 1)
        {
            e.CellStyle.Locked = true;
        }
    }
    ```