Gets or sets a value indicating whether the column allows changes once a row has been added to the table.
[Visual Basic] Public Property ReadOnly As Boolean [C#] public bool ReadOnly {get; set;} [C++] public: __property bool get_ReadOnly(); public: __property void set_ReadOnly(bool); [JScript] public function get ReadOnly() : Boolean; public function set ReadOnly(Boolean);
true if the column is read only; otherwise, false. The default is false.
Exception Type | Condition |
---|---|
ArgumentException | The property is set to false on a computed column. |
The OnPropertyChanged event occurs when the property value is successfully changed.
The following example creates a DataColumn and sets its ReadOnly property true.
[Visual Basic]
Private Sub AddColumn() Dim cols As ColumnsCollection Dim myCol As DataColumn Dim myTable As New DataSet1.Tables("Prices") cols = myTable.Columns myCol = cols.Add("Total") With myCol .DataType = System.Type.GetType("System.Currency") .ReadOnly = True .Expression = "UnitPrice * Quantity" .Unique = False End With End Sub
DataColumn Class | DataColumn Members | System.Data Namespace | Unique | AutoIncrement