I need to implement keypress handler that works anywhere on a form (actually so long as I am on one of several tab pages on my form which is basically a tab control with 4 pages. Here is the problem - my TabControl.Keypress handler intercepts the keypress only of one of the grids on that same tab does not have focus. Essentially, once I select a row on a grid, my handler no longer receives keypresses, as they are now aparently directed to the selected grid. The handler is invoked if I am editing one of the edit controls. How can I intercept ALL keypresses within the form/tab page? Do I have to resort to the windows message handler?

Re: keypress handling by hirf-spam-me-here

hirf-spam-me-here
Fri Jan 23 06:49:44 CST 2004

* "=?Utf-8?B?Z2Fycmljaw==?=" <anonymous@discussions.microsoft.com> scripsit:
> I need to implement keypress handler that works anywhere on a form
> (actually so long as I am on one of several tab pages on my form which
> is basically a tab control with 4 pages. Here is the problem - my
> TabControl.Keypress handler intercepts the keypress only of one of the
> grids on that same tab does not have focus. Essentially, once I select a
> row on a grid, my handler no longer receives keypresses, as they are now
> aparently directed to the selected grid. The handler is invoked if I am
> editing one of the edit controls. How can I intercept ALL keypresses
> within the form/tab page? Do I have to resort to the windows message
> handler?

Did you set the form's 'KeyPreview' property to 'True'?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Re: keypress handling by ClayB

ClayB
Fri Jan 23 07:04:09 CST 2004

Have you tried setting the Form's KeyPreview property to true?

====================
Clay Burch, .NET MVP

Visit www.syncfusion.com for the coolest tools

"garrick" <anonymous@discussions.microsoft.com> wrote in message
news:64C69FBA-D74A-47CD-AC6C-106FA99D2CDA@microsoft.com...
> I need to implement keypress handler that works anywhere on a form
(actually so long as I am on one of several tab pages on my form which is
basically a tab control with 4 pages. Here is the problem - my
TabControl.Keypress handler intercepts the keypress only of one of the grids
on that same tab does not have focus. Essentially, once I select a row on a
grid, my handler no longer receives keypresses, as they are now aparently
directed to the selected grid. The handler is invoked if I am editing one of
the edit controls. How can I intercept ALL keypresses within the form/tab
page? Do I have to resort to the windows message handler?