Protected Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean If currentCell IsNot Nothing Then Dim rowIndex As Integer = currentCell.RowIndex Dim colIndex As Integer = currentCell.ColIndex Dim info As GridStyleInfo = Me.gridControl1.Model(rowIndex, colIndex) 'Restricting the F4 and SpaceBar function If (keyData = Keys.Space AndAlso info.CellType Is "CheckBox") OrElse (keyData = Keys.F4 AndAlso info.CellType Is "ComboBox") Then Return True End If End If Return MyBase.ProcessCmdKey(msg, keyData) End Function |
Private currentCell As GridCurrentCell 'Event Triggering AddHandler gridControl1.KeyDown, AddressOf gridControl1_KeyDown 'Event Customization Private Sub gridControl1_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) If Me.gridControl1.EnterKeyBehavior = GridDirectionType.None Then currentCell = Me.gridControl1.CurrentCell Dim rowIndex As Integer = currentCell.RowIndex Dim colIndex As Integer = currentCell.ColIndex Dim info As GridStyleInfo = Me.gridControl1.Model(rowIndex, colIndex) 'Activate the enter key for checkbox If e.KeyCode = Keys.Enter AndAlso info.CellType Is "CheckBox" Then e.Handled = True If info.CellValue.ToString() = "true" Then info.CellValue = "false" Else info.CellValue = "true" End If End If 'Activate the enter key for combobox If e.KeyCode = Keys.Enter AndAlso info.CellType Is "ComboBox" Then e.Handled = True If Not currentCell.IsDroppedDown Then currentCell.ShowDropDown() Else currentCell.CloseDropDown(Syncfusion.Windows.Forms.PopupCloseType.Canceled) End If End If End If End Sub |