property Grid.AutoEdit as Boolean
Specifies whether the cell may be edited when it has the focus.

TypeDescription
Boolean A boolean expression that indicates whether the editing operation starts once that a cell is focused.

Use the AutoEdit property to choose how the user edits the data. By default, the AutoEdit property is True. Use the Edit method to start editing the focused cell. Use the EditType property to define the column's editor. Use the ReadOnly property to make the control read only. Use the FocusItem property to retrieve the focused item. Use the FocusColumnIndex property to get the index of the column that's focused. Use the Editing property to check whether the control is in edit mode, or to get the window's handle for the built-in editor that's visible and focused.

The edit events are fired in the following order:

  1. Edit event. Prevents editing cells, before showing the cell's editor.

  2. EditOpen event. The edit operation started, the cell's editor is shown. The Editing property gives the window's handle of the built-in editor being started.

  3. Change event. The Change event is fired only if the user types ENTER key, or the user selects a new value from a predefined data list.

  4. EditClose event. The cell's editor is hidden and closed.

The following VB sample starts editing a cell when user presses the F4 key:

Private Sub Grid1_KeyDown(KeyCode As Integer, Shift As Integer)
    ' Starts editing data when the user presses the F4 key
    With Grid1
        If (Not .AutoEdit) Then
            If (KeyCode = vbKeyF4) Then .Edit
        End If
    End With
End Sub

The following C++ sample starts editing the focused cell when user presses the F4 key:

void OnKeyDownGrid1(short FAR* KeyCode, short Shift) 
{
	if ( *KeyCode == VK_F4 )
	{
		COleVariant vtMissing; V_VT( &vtMissing) = VT_ERROR;
		if ( m_grid.GetEditing() == 0 )
			m_grid.Edit( vtMissing );
	}
}

The following VB.NET sample starts editing the focused cell when user presses the F4 key:

Private Sub AxGrid1_KeyDownEvent(ByVal sender As Object, ByVal e As AxEXGRIDLib._IGridEvents_KeyDownEvent) Handles AxGrid1.KeyDownEvent
    If (Convert.ToUInt32(e.keyCode) = Convert.ToUInt32(Keys.F4)) Then
        AxGrid1.Edit(Nothing)
    End If
End Sub

The following C# sample starts editing the focused cell when user presses the F4 key:

private void axGrid1_KeyDownEvent(object sender, AxEXGRIDLib._IGridEvents_KeyDownEvent e)
{
	if (Convert.ToUInt32(e.keyCode) == Convert.ToUInt32(Keys.F4))
		axGrid1.Edit(null);
}

The following VFP sample starts editing the focused cell when user presses the F4 key:

private void axGrid1_KeyDownEvent(object sender, AxEXGRIDLib._IGridEvents_KeyDownEvent e)
{
	if (Convert.ToUInt32(e.keyCode) == Convert.ToUInt32(Keys.F4))
		axGrid1.Edit(null);
}