Another question:

I’ve been breaking my head over some inconsistent behavior of my grid, but fail to see what I do wrong. Hopefully someone can point me in the right direction.

The grid has 2 columns. The first column with labels is locked, the second column allows the user to input / change data, unless the cell backcolor is &H80000011 (i.e. simulating “grayed out”). When the user pressed the Enter key, the input is confirmed, and the focus is set to the next cell. The grid has 20 rows, and when row 20 has been reached, the focus jumps to another grid.

The inconsistent behavior is that in some cases the cell goes into edit-mode and displays the value in the next cell fully selected, but in other cases only the cell is selected.

This is the code for the control:

Code:
Private Sub grdDescriptions_BeforeEdit(Row As Long, Col As Long, ByVal Reason As VBFLXGRD14.FlexEditReasonConstants, Cancel As Boolean)
    If grdDescriptions.CellBackColor = &H80000011 Then
        'Don't go into edit mode as this is a locked cell
        Cancel = True
    End If
End Sub

Private Sub grdDescriptions_Click()
    grdDescriptions.Col = 1
    grdDescriptions.StartEdit
End Sub

Private Sub grdDescriptions_EditKeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyTab Then
        KeyCode = vbKeyReturn
    End If
End Sub

Private Sub grdDescriptions_LostFocus()
    m_blnGridDescriptionsHasFocus = False
End Sub

Private Sub grdDescriptions_MouseEnter()
    If m_blnGridDescriptionsHasFocus = False Then
        grdDescriptions.SetFocus
        m_blnGridDescriptionsHasFocus = True
    End If
End Sub

Private Sub grdDescriptions_PreviewKeyDown(ByVal KeyCode As Integer, IsInputKey As Boolean)
    If KeyCode = vbKeyTab Then
        If grdDescriptions.hWndEdit <> 0 Then
            IsInputKey = True
        End If
    ElseIf KeyCode = vbKeyReturn Then
        If grdDescriptions.Row < 19 Then
            grdDescriptions.Row = grdDescriptions.Row + 1
            grdDescriptions.StartEdit
        Else
            grdData.SetFocus
            grdData.Col = 1
            grdData.Row = 0
            grdData.StartEdit
        End If
    End If
End Sub
What am I missing?