'bout the only thing I can think of is to make the datagrid read only (DataGrid.AllowUpdate = FALSE). An attempt to cut the contents of a cell (CTRL-X) will then fail because it's an attempt to modify data in the grid.
Private Sub DataGrid1_KeyPress(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyPressEventArgs) _
Handles DataGrid1.KeyPress
Dim byt As Byte = Convert.ToByte(e.KeyChar)
#If Debug then
MessageBox.Show("Byte=" & byt.ToString("##"))
#End If
If byt = 24 Then ' Ctrl+X
e.Handled = True
End If
End Sub
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'If we're supposed to work in Hex, why have we only got A fingers?'
Private Sub DataGrid1_KeyDown(KeyCode As Integer, Shift As Integer)
If Shift And vbCtrlMask Then
If KeyCode = vbKeyX Then
Debug.Print "You pressed ctrl + x"
'Discard the key
KeyCode = 0
End If
End If
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.