Export (0) Print
Expand All

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)

public virtual bool ReadOnly { get; set; }
/** @property */
public boolean get_ReadOnly ()

/** @property */
public void set_ReadOnly (boolean value)

public function get ReadOnly () : boolean

public function set ReadOnly (value : boolean)

Not applicable.

Property Value

true if the cell's data cannot be edited; otherwise, false.

Exception typeCondition

InvalidOperationException

There is no owning row when setting this property.

-or-

The owning row is shared when setting this property.

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.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2015 Microsoft