Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1165
Set focus on first non-read-only cell in a row
posted

I have a grid where the first column is read-only and the remaining cells are editable.

I have tabbing set to NextCell.  What I want is for a user to be able to tab into a new row and have focus set to the first editable cell in edit mode.

The following code works when I insert a stopper in the beginning of the event and step through; however, without the stopper it works, but then returns focus to the first cell in the row, causing a flicker, plus not doing what I want.

 Private Sub grdAccountSettings_AfterRowActivate(ByVal sender As Object, ByVal e As System.EventArgs) Handles grdAccountSettings.AfterRowActivate
        Try
            If Not _OnInit Then
                If grdAccountSettings.ActiveRow.Index > 0 And (grdAccountSettings.ActiveCell Is Nothing OrElse grdAccountSettings.ActiveCell.Column.Index = 0) Then
                    grdAccountSettings.ActiveRow.Cells(1).Activate()
                    grdAccountSettings.PerformAction(UltraGridAction.EnterEditMode, False, False)
                End If
            End If
        Catch ex As Exception
            Debug.Write(ex.Message)
        End Try
    End Sub