473,396 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 1212
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Wortelvisje | last post by:
Hello, What I want to do is quit simple: if the does clicks on the cross at the right top of the screen I want to catch this event and check a few things before closing the window. The only...
2
by: Olli Piepponen | last post by:
Hi, I'm having a little problem catching keystrokes under Windows. I did a little research and found that with mscvrt.getch() one can cath a single key that is pressed. However this doesn't work...
1
by: CGuy | last post by:
Hi, I have a datagrid that supports bi-directional sorting - i would like an icon (like an up or down arrow depending on the sort order) to be displayed in the datagrid column headers which...
2
by: Carl Tribble | last post by:
I am using KeyPreview on the form to trap Function-keys. My form includes a datagrid. I am using the Form.KeyDown event to trap the keys and all works fine unless the datagrid is showing one or...
0
by: Nick Lewis | last post by:
I'm trying to process an event raised by a user control in the web form that contains that control. I've fathomed out how to handle the event within the control but how can I then pass it on to...
1
by: B | last post by:
Hi, I would like to split up an mdi form using a splitter where a datagrid would be on the left side and child forms on the right side. So far, I have placed a splitter on the form, dragged it...
0
by: BrianDH | last post by:
Hi VB,Net / DataGrid / Web form / Bound to Dataset. I have a Datagrid with a Select Push-button button in column 1. When the button is pushed no event firers. Neither of these two events will...
2
by: Rich | last post by:
Hello, If I place a panel control on a form and place a datagrid on the panel, is there a property for the panel to resize with the form? I am sure there is. I just can't remember what the...
0
by: SanjayKumarDey | last post by:
I have a vb.net datagrid bound to a dataview on a windows form. I want to use the datagrid to display and filter a list of items , but since the data is complex, I don't want the user to edit the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.