.NET Framework Class Library DataGridViewCell..::.ReadOnly Property Gets or sets a value indicating whether the cell's data can be edited.
Namespace:
System.Windows.Forms
Assembly:
System.Windows.Forms (in System.Windows.Forms.dll)

Syntax
<BrowsableAttribute(False)> _
Public Overridable Property ReadOnly As Boolean
Get
Set
[BrowsableAttribute(false)]
public virtual bool ReadOnly { get; set; }
[BrowsableAttribute(false)]
public:
virtual property bool ReadOnly {
bool get ();
void set (bool value);
}
[<BrowsableAttribute(false)>]
abstract ReadOnly : bool with get, set
[<BrowsableAttribute(false)>]
override ReadOnly : bool with get, set
Property ValueType: System..::.Boolean
true if the cell's data cannot be edited; otherwise, false.

Exceptions
| Exception | Condition |
|---|
| InvalidOperationException | There is no owning row when setting this property. -or- The owning row is shared when setting this property. |

Remarks
The ReadOnly property indicates whether the data displayed by the cell can be edited. You can set ReadOnly for individual cells, or you can make an entire row or column of cells read-only by setting the DataGridViewRow..::.ReadOnly or DataGridViewColumn..::.ReadOnly properties. By default, if a cell's parent row or column is set to read-only, the child cells will adopt the same value. You can override this default behavior by setting ReadOnly for individual cells. You can navigate to a read-only cell, and you can set a read-only cell to be the current cell.
ReadOnly only affects whether a cell is editable; it does not affect whether the user can delete rows.

Version Information
.NET FrameworkSupported in: 4, 3.5, 3.0, 2.0 .NET Framework Client ProfileSupported in: 4, 3.5 SP1

Platforms
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

See Also
|
Biblioteca de clases de .NET Framework DataGridViewCell..::.ReadOnly (Propiedad) Obtiene o establece un valor que indica si se pueden editar los datos de la celda.
Espacio de nombres:
System.Windows.Forms
Ensamblado:
System.Windows.Forms (en System.Windows.Forms.dll)

Sintaxis
<BrowsableAttribute(False)> _
Public Overridable Property ReadOnly As Boolean
Get
Set
[BrowsableAttribute(false)]
public virtual bool ReadOnly { get; set; }
[BrowsableAttribute(false)]
public:
virtual property bool ReadOnly {
bool get ();
void set (bool value);
}
[<BrowsableAttribute(false)>]
abstract ReadOnly : bool with get, set
[<BrowsableAttribute(false)>]
override ReadOnly : bool with get, set
Valor de propiedadTipo: System..::.Boolean
true si no se pueden editar los datos de la celda; de lo contrario, false.

Excepciones
| Excepción | Condición |
|---|
| InvalidOperationException | No hay ninguna fila propietaria cuando se establece esta propiedad. O bien La fila propietaria está compartida cuando se establece esta propiedad. |

Comentarios
La propiedad ReadOnly indica si se pueden editar los datos que muestra la celda. Se puede establecer ReadOnly para las celdas individuales o hacer que toda una fila o columna de celdas sea de sólo lectura estableciendo las propiedades DataGridViewRow..::.ReadOnly o DataGridViewColumn..::.ReadOnly. De forma predeterminada, si la fila o columna primarias de una celda se establecen como de sólo lectura, las celdas secundarias adoptan el mismo valor. Puede reemplazar este comportamiento predeterminado estableciendo ReadOnly para celdas concretas. Puede navegar hasta una celda de sólo lectura, y también establecer que una celda de sólo lectura sea la celda actual.
ReadOnly sólo influye en si una celda se puede modificar o no; no influye en que el usuario pueda eliminar filas o no.

Información de versión
.NET FrameworkCompatible con: 4, 3.5, 3.0, 2.0 .NET Framework Client ProfileCompatible con: 4, 3.5 SP1

Plataformas
Windows 7, Windows Vista SP1 o posterior, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (no se admite Server Core), Windows Server 2008 R2 (se admite Server Core con SP1 o posterior), Windows Server 2003 SP2
.NET Framework no admite todas las versiones de todas las plataformas. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

Vea también
|