Gets or sets a value indicating whether the data in the column cannot be edited.
[Visual Basic] Overridable Public Property ReadOnly As Boolean [C#] public bool ReadOnly {virtual get; virtual set;} [C++] public: __property virtual bool get_ReadOnly(); public: __property virtual void set_ReadOnly(bool); [JScript] public function get ReadOnly() : Boolean; public function set ReadOnly(Boolean);
true, if the data can't be edited; otherwise, false.
Make a read only if it contains a primary key or if its value is generated automatically (as when the DataColumn object's AutoIncrement property is set to true).
Similar read only properties exist on other classes, each allowing more detailed control over the access to data. Specifically, the entire DataGrid control can be set to read-only mode with by using its ReadOnly property and the DataColumn class has a ReadOnly property for restricting data updates.
The following example sets the DataGridColumn object's ReadOnly property to the same value as the DataColumn object's ReadOnly property.
[Visual Basic]
Private Sub SetReadOnly() Dim dgCols As GridColumnsCollection Dim dgc As DataGridColumn Set dgCols = DataGrid1.GridColumns For Each dgc In dgCols dgc.ReadOnly = dgc.DataColumn.ReadOnly Next End Sub
DataGridColumn Class | DataGridColumn Members | System.WinForms Namespace | AutoIncrement | DataColumn