PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Framework Forms How to trap <Ctrl+Tab> is DataGridView

Reply

How to trap <Ctrl+Tab> is DataGridView

 
Thread Tools Rate Thread
Old 03-01-2008, 08:40 PM   #1
John B.
Guest
 
Posts: n/a
Default How to trap <Ctrl+Tab> is DataGridView


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.


  Reply With Quote
Old 03-01-2008, 08:55 PM   #2
AMercer
Guest
 
Posts: n/a
Default RE: How to trap <Ctrl+Tab> is DataGridView

> ... 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

  Reply With Quote
Old 03-01-2008, 09:21 PM   #3
John B.
Guest
 
Posts: n/a
Default Re: How to trap <Ctrl+Tab> is DataGridView

>> 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


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.


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off