Spread Windows Forms 11.0 Product Documentation
Locked Property (Column)
Example 


FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > Column Class : Locked Property
Gets or sets whether cells in this column are marked as locked.
Syntax
'Declaration
 
Public Property Locked As Boolean
'Usage
 
Dim instance As Column
Dim value As Boolean
 
instance.Locked = value
 
value = instance.Locked
public bool Locked {get; set;}

Property Value

Boolean: true if marked as locked; false otherwise
Remarks

You can specify that certain columns of cells are locked; that is, the user cannot edit them. You mark columns of cells as locked by setting this property to true. Columns of cells are not locked until the SheetView Protect property is also set to true for the sheet. Because the default value of the Protect property is true, unless you have changed the value of the Protect property, when you mark a column of cells as locked, they are locked and the user cannot edit them. When the Protect property is false, the user can still interact with cells marked as locked.

Be aware that the setting for this property can be overridden if a named style is assigned to the cell using the StyleName property, and that named style sets the locked status.

Example
This example locks the cells in the column so they cannot be edited when the Protect property is set to True.
FarPoint.Win.Spread.Column col;
int i, j;
col = fpSpread1.ActiveSheet.Columns[0, 2];
col.Locked = true;
for (i = 0; i <= col.Index2; i++)
{
      for (j = 0; j <= fpSpread1.ActiveSheet.RowCount - 1; j++)
            fpSpread1.ActiveSheet.Cells[j, i].Text = "Locked";
}
Dim col As FarPoint.Win.Spread.Column
Dim i, j As Integer
col = fpSpread1.ActiveSheet.Columns(0, 2)
col.Locked = True
For i = 0 To col.Index2
      For j = 0 To fpSpread1.ActiveSheet.RowCount - 1
            fpSpread1.ActiveSheet.Cells(j, i).Text = "Locked"
      Next j
Next i
See Also

Reference

Column Class
Column Members
Protect Property