DataColumn.ReadOnly Propiedad
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Obtiene o establece un valor que indica si la columna permite cambios justo después de que se haya agregado una fila a la tabla.
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
si la columna es de sólo lectura; en caso contrario, false
. De manera predeterminada, es false
.
- Atributos
La propiedad está establecida en false
en una columna calculada.
En el ejemplo siguiente se crea un DataColumn objeto y se establece su ReadOnly propiedad 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
Producto | Versiones |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.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 |
Comentarios de .NET
.NET es un proyecto de código abierto. Selecciona un vínculo para proporcionar comentarios: