EditMode Property
TOC
Collapse the table of content
Expand the table of content

DataGridView.EditMode Property

 

Gets or sets a value indicating how to begin editing a cell.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

member EditMode : DataGridViewEditMode with get, set

Property Value

Type: System.Windows.Forms.DataGridViewEditMode

One of the DataGridViewEditMode values. The default is EditOnKeystrokeOrF2.

Exception Condition
InvalidEnumArgumentException

The specified value when setting this property is not a valid DataGridViewEditMode value.

Exception

The specified value when setting this property would cause the control to enter edit mode, but initialization of the editing cell value failed and either there is no handler for the DataError event or the handler has set the DataGridViewDataErrorEventArgs.ThrowException property to true. The exception object can typically be cast to type FormatException.

All DataGridViewEditMode values except for EditProgrammatically also allow a user to double-click a cell to begin editing it.

The following code example demonstrates how to initialize a simple data-bound DataGridView. It also demonstrates how to set the EditMode property.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show:
© 2016 Microsoft