How to trap <Ctrl+Tab> is DataGridView

  • Thread starter Thread starter John B.
  • Start date Start date
J

John B.

Please forgive my rant, but trapping keystrokes in .NET couldn't get much
worse if someone tried. Sorry to vent my frustration but I've had no end of
problems with this for the past 18 months. The entire system is a convoluted
mess and really needs a complete overhaul. With that off my chest, does
anyone know how to trap <Ctrl+Tab> while in edit mode in a "DataGridView"
("TextBox") cell. I'd certainly appreciate the info since I've pounded away
at this for hours now and nothing seems to work. Thanks in advance.
 
... does
anyone know how to trap <Ctrl+Tab> while in edit mode in a "DataGridView"
("TextBox") cell. I'd certainly appreciate the info since I've pounded away
at this for hours now and nothing seems to work. Thanks in advance.


I think the best way is with PreviewKeyDown -

Private Sub DataGridView1_PreviewKeyDown(ByVal sender As Object, ByVal e
As System.Windows.Forms.PreviewKeyDownEventArgs) _
Handles DataGridView1.PreviewKeyDown
If e.Control And e.KeyCode = Keys.Tab Then
Beep()
End If
End Sub
 
anyone know how to trap said:
I think the best way is with PreviewKeyDown -

Private Sub DataGridView1_PreviewKeyDown(ByVal sender As Object, ByVal e
As System.Windows.Forms.PreviewKeyDownEventArgs) _
Handles DataGridView1.PreviewKeyDown
If e.Control And e.KeyCode = Keys.Tab Then
Beep()
End If
End Sub

Thanks very much! That actually works when when I put it in my "TextBox"
derivative. Unfortunately, there's a bewildering number of keystroke
functions in .NET and various properties that affect it. Frequently these
functions aren't even called depending on the keystroke, control, etc.. The
situation becomes much worse when dealing with a "DataGridView" in
particular since you now have the parent form (object) itself, the
"DataGridView" object, "DataGridViewCell" objects, and the underlying
editing control objects. The number of permutations involved with all the
possible keystrokes functions, properties, special keystrokes, etc. is
mind-numbing. Coupled with documentation that's very weak, it's frequently
very difficult to accomplish even the most basic tasks. In any case, your
help was greatly appreciated. Thanks again.
 
Back
Top