ComponentOne True DBGrid for WinForms
True DBGrid for WinForms Task-Based Help / Controlling Grid Interaction / Restricting Editing in Specific Columns
In This Topic
    Restricting Editing in Specific Columns
    In This Topic

    To restrict editing in specific columns, set the Locked property to True. This property can be set either in the designer or in code.

    In the Designer

    Complete the following steps to lock the Last column:

    1. Open the C1TrueDBGrid Designer. For information on how to access the C1TrueDBGrid Designer, see Accessing the C1TrueDBGrid Designer.
    2. In the designer, select the Last column by clicking it in the right pane.
      The column can also be selected by choosing Last from the drop-down list in the toolbar.
    3. Click the Display Column tab in the left pane.
    4. Locate the Locked property and set it to True.
    5. Click OK to close the designer.

    In Code

    Add the following code to the Form_Load event to lock the Last column:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Me.C1TrueDBGrid1.Splits(0).DisplayColumns("Last").Locked = True
    

    To write code in C#

    C#
    Copy Code
    this.c1TrueDBGrid1.Splits[0].DisplayColumns["Last"].Locked = true;
    

    What You've Accomplished

    The cells in the Last column cannot be edited, but other columns can be edited: