DataColumn.ReadOnly Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets a value that indicates whether the column allows for changes as soon as a row has been added to the table.
public:
property bool ReadOnly { bool get(); void set(bool value); };
public bool ReadOnly { get; set; }
[System.Data.DataSysDescription("DataColumnReadOnlyDescr")]
public bool ReadOnly { get; set; }
member this.ReadOnly : bool with get, set
[<System.Data.DataSysDescription("DataColumnReadOnlyDescr")>]
member this.ReadOnly : bool with get, set
Public Property ReadOnly As Boolean
true
if the column is read only; otherwise, false
. The default is false
.
- Attributes
The property is set to false
on a computed column.
The following example creates a DataColumn and sets its ReadOnly property true
.
private void AddColumn(DataTable table)
{
// Add a DataColumn to the collection and set its properties.
// The constructor sets the ColumnName of the column.
DataColumn column = table.Columns.Add("Total");
column.DataType = System.Type.GetType("System.Decimal");
column.ReadOnly = true;
column.Expression = "UnitPrice * Quantity";
column.Unique = false;
}
Private Sub AddColumn(ByVal table As DataTable)
' Add a DataColumn to the collection and set its properties.
' The constructor sets the ColumnName of the column.
Dim column As DataColumn = table.Columns.Add("Total")
column.DataType = System.Type.GetType("System.Decimal")
column.ReadOnly = True
column.Expression = "UnitPrice * Quantity"
column.Unique = False
End Sub
Produkt | Verzie |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
Pripomienky k produktu .NET
.NET je open-source projekt. Ak chcete poskytnúť pripomienky, vyberte prepojenie: