469,356 Members | 2,618 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,356 developers. It's quick & easy.

catching keystrokes from a Datagrid cell---that should be form wide--like F6, F7, etc.

I want to use F6,F7,etc for an entire form.

Have key preview to true and it works everywhere but on the grid.
On the grid sometimes it works and sometimes not.

Appears that if I am in a cell and press one of them it won't work.

Any ideas?

Shane
Nov 20 '05 #1
4 1109
Hi,

Try to override the grid's ProcessDialogKey and ProcessKeyPreview methods to
prevent them from "eating" these keys.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"SStory" <Th*******@TAKETHISSPAMBUSTEROUT.Softhome.net> wrote in message
news:OJ**************@TK2MSFTNGP09.phx.gbl...
I want to use F6,F7,etc for an entire form.

Have key preview to true and it works everywhere but on the grid.
On the grid sometimes it works and sometimes not.

Appears that if I am in a cell and press one of them it won't work.

Any ideas?

Shane


Nov 20 '05 #2
jim
Hi Shane, each datagrid cell is actually it's own control. To capture
keystrokes within the datagrid cell you must dynamically add a handler to
each cell at runtime. something along the lines of

dim myControl as Control
for each myControl in myDataGrid.Controls
addhandler mycontrol.KeyDown, addressof myHandler
next

i wrote this code off the top of my head so it's not tested, but you can
find more than enough examples of this if you do a search on google in the

microsoft.public.dotnet.framework.windowsforms.con trols

group.

http://tinyurl.com/xd7i

hope this helps a little,

Jim

"SStory" <Th*******@TAKETHISSPAMBUSTEROUT.Softhome.net> wrote in message
news:OJ**************@TK2MSFTNGP09.phx.gbl...
I want to use F6,F7,etc for an entire form.

Have key preview to true and it works everywhere but on the grid.
On the grid sometimes it works and sometimes not.

Appears that if I am in a cell and press one of them it won't work.

Any ideas?

Shane

Nov 20 '05 #3
Thanks, although I didn't want to inherit the control just wanted to use it.

"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.com> wrote
in message news:e1**************@TK2MSFTNGP10.phx.gbl...
Hi,

Try to override the grid's ProcessDialogKey and ProcessKeyPreview methods to prevent them from "eating" these keys.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"SStory" <Th*******@TAKETHISSPAMBUSTEROUT.Softhome.net> wrote in message
news:OJ**************@TK2MSFTNGP09.phx.gbl...
I want to use F6,F7,etc for an entire form.

Have key preview to true and it works everywhere but on the grid.
On the grid sometimes it works and sometimes not.

Appears that if I am in a cell and press one of them it won't work.

Any ideas?

Shane

Nov 20 '05 #4
Thanks Jim,

took a little fooling around with but worked great! I had tried everything.

Thanks again.

Shane

"jim" <james_matthews_at_shi_dotcom> wrote in message
news:un**************@tk2msftngp13.phx.gbl...
Hi Shane, each datagrid cell is actually it's own control. To capture
keystrokes within the datagrid cell you must dynamically add a handler to
each cell at runtime. something along the lines of

dim myControl as Control
for each myControl in myDataGrid.Controls
addhandler mycontrol.KeyDown, addressof myHandler
next

i wrote this code off the top of my head so it's not tested, but you can
find more than enough examples of this if you do a search on google in the

microsoft.public.dotnet.framework.windowsforms.con trols

group.

http://tinyurl.com/xd7i

hope this helps a little,

Jim

"SStory" <Th*******@TAKETHISSPAMBUSTEROUT.Softhome.net> wrote in message
news:OJ**************@TK2MSFTNGP09.phx.gbl...
I want to use F6,F7,etc for an entire form.

Have key preview to true and it works everywhere but on the grid.
On the grid sometimes it works and sometimes not.

Appears that if I am in a cell and press one of them it won't work.

Any ideas?

Shane


Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Wortelvisje | last post: by
2 posts views Thread by Olli Piepponen | last post: by
2 posts views Thread by Carl Tribble | last post: by
reply views Thread by Nick Lewis | last post: by
reply views Thread by BrianDH | last post: by
2 posts views Thread by Rich | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.