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
1187
Change selected cell when user clicks on cell not editable.
posted

 I have a grid with several columns, only the two right most columns are editable.  When a user clicks on a cell that isn't editable, I want focus to go to the first cell on that row that is editable.  Why doesn't the following code work?  The selected cell stays on the cell clicked on.

     Private Sub grdOptions_BeforeSelectChange(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BeforeSelectChangeEventArgs) Handles grdOptions.BeforeSelectChange
        If e.NewSelections.Cells.Count = 0 Then Exit Sub
        If e.NewSelections.Cells(0).Column.CellActivation = Activation.AllowEdit Then Exit Sub
        e.Cancel = True
        For Each c As UltraGridCell In e.NewSelections.Cells(0).Row.Cells
            If c.Column.CellActivation = Activation.AllowEdit Then
                LogCommon.WriteDebug(New String() {"grdOptions_BeforeSelectChange()", "Select Changed To", c.Column.Header.Caption})
                c.Selected = True
                Exit For
            End If
        Next
    End Sub