| True DBGrid for WinForms Task-Based Help > Controlling Grid Interaction > Restricting Editing in Specific Columns |
To restrict editing in specific columns, set the Locked property to True. This property can be set either in the designer or in code.
Complete the following steps to lock the Last column:
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; |
|
The cells in the Last column cannot be edited, but other columns can be edited: