Hello...
I'm hoping someone can help me with what I think is a fairly simple problem. I'd like to write a class that inherits from DataGridView that I can drop on forms with some simple changes. One of the things I'd like to do is to have the user pressing the [enter] key trigger the same behavior as the "CellDoubleClick" event.
So, what's the best way of doing that? In code, this is basically what I'm after. The commented out line doesn't work, it's just the gist of what I want to do.
Thanks!
I'm hoping someone can help me with what I think is a fairly simple problem. I'd like to write a class that inherits from DataGridView that I can drop on forms with some simple changes. One of the things I'd like to do is to have the user pressing the [enter] key trigger the same behavior as the "CellDoubleClick" event.
So, what's the best way of doing that? In code, this is basically what I'm after. The commented out line doesn't work, it's just the gist of what I want to do.
Thanks!
VB.NET:
Public Class DataGridViewExtension
Inherits DataGridView
Private Shadows Sub PreviewKeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PreviewKeyDownEventArgs) Handles MyBase.PreviewKeyDown
If e.KeyCode = Keys.Enter Then
' MyBase.CellDoubleClick(sender, Nothing)
End If
End Sub
End Class