NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DataColumn.ReadOnly

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);

Property Value

true if the column is read only; otherwise, false. The default is false.

Exceptions

Exception Type Condition
ArgumentException The property is set to false on a computed column.

Remarks

The OnPropertyChanged event occurs when the property value is successfully changed.

Example [Visual Basic]

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

See Also

DataColumn Class | DataColumn Members | System.Data Namespace | Unique | AutoIncrement