2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
Skip the deleting cell in gridWhen you set the ComboBox in a Grid and assign the dropdown style as exclusive, the cell text is removed from the ComboBox cell while pressing delete key or backspace key. Solution To overcome this problem, you can use the CurrentCellKeyDown event to handle the Delete & BackSpace keys. C# // On Form load this.gridControl1.CurrentCellKeyDown += new KeyEventHandler(gridControl1_CurrentCellKeyDown); void gridControl1_CurrentCellKeyDown(object sender, KeyEventArgs e) { GridCurrentCell cc = this.gridControl1.CurrentCell; if (cc.Renderer.StyleInfo.CellType == "ComboBox" && cc.Renderer.StyleInfo.DropDownStyle == GridDropDownStyle.Exclusive) { // Pressing delete key or backspacekey if (e.KeyCode == Keys.Back || e.KeyCode == Keys.Delete) { // not remove the cell content e.Handled = true; } } } VB ‘On Form load AddHandler gridControl1.CurrentCellKeyDown, AddressOf gridControl1_CurrentCellKeyDown ' to perform action while pressing key Private Sub gridControl1_CurrentCellKeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Dim cc As GridCurrentCell = Me.gridControl1.CurrentCell If cc.Renderer.StyleInfo.CellType Is "ComboBox" AndAlso cc.Renderer.StyleInfo.DropDownStyle = GridDropDownStyle.Exclusive Then ' Pressing delete key or backspacekey If e.KeyCode = Keys.Back OrElse e.KeyCode = Keys.Delete Then ' not remove the cell content e.Handled = True End If End If End Sub Samples: |
2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.