When the delete key is pressed, I want to set the value of the current cell's text to "".
I tried this in the KeyDown and KeyPress events. Neither worked. (I expected it to work for any key, not just Delete.) It does nothing visible.
vb Code:
Private Sub grdG1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles grdG1.KeyPress Dim grd As DataGridView = DirectCast(sender, DataGridView) grd.CurrentCell.Value = "" End Sub
By the way, is Nothing the same as ""? Or could the first one cause Null error when the 2nd doesn't?




Reply With Quote