473,489 Members | 2,490 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Windows Forms Datagrid and Form.KeyPreview

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 more rows and the focus is in a
column on one of the datagrid's rows. Then, pressing a function key does
not seem to execute the Form.KeyDown event.

How can I trap and detect which function key a user pressed at the form
level from inside of a filled datagrid?

Thanks,
-Carl
Jul 22 '05 #1
2 1667
Hi,

http://64.78.52.104/FAQ/WinForms/FAQ_c44c.asp#q836q

Ken
------------------
"Carl Tribble" <ca**@tribblesoftware.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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 more rows and the focus is in a
column on one of the datagrid's rows. Then, pressing a function key does
not seem to execute the Form.KeyDown event.

How can I trap and detect which function key a user pressed at the form
level from inside of a filled datagrid?

Thanks,
-Carl

Jul 22 '05 #2
Thanks, Ken. I downloaded the sample code and experimented with it for
awhile. It works of course but it also produces some side effects that, in
my case at least, are undesirable. For one you can no longer select an
entire row by clicking on the row header. You have to click it twice.
Also, and more importantly, it seems that you can not delete the contents of
a cell.

Perhaps these matters can be fixed by altering the code slightly. I tried a
few things with no success. Is there another solution to this problem? Or
do you know a way to deal with those side-effects (at least the not being
able to delete problem)?

Thanks,
-Carl

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hi,

http://64.78.52.104/FAQ/WinForms/FAQ_c44c.asp#q836q

Ken
------------------
"Carl Tribble" <ca**@tribblesoftware.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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 more rows and the focus is in a
column on one of the datagrid's rows. Then, pressing a function key does
not seem to execute the Form.KeyDown event.

How can I trap and detect which function key a user pressed at the form
level from inside of a filled datagrid?

Thanks,
-Carl

Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1109
by: Chris Mayers | last post by:
Hi, Hope that someone can shed some light on this. I've got an MDI application with (for the sake of this discussion) 2 child forms. Both of these forms inherit from on a common 'Base' form...
2
1450
by: Wayne | last post by:
I have a datagrid on my windows form, it needs to be read only and when a user selects a row, I want the whole row to be selected. How would I go about doing this? -- Thanks Wayne Sepega...
3
4001
by: Sumit | last post by:
Hi all, Is there any way to disable copy & paste options using ctrl + Insert & Shift + Insert respectively on Windows forms using C#. Kindly Help !! Regards Sumit Vohra
1
1671
by: Gidi | last post by:
Hi, I have DataGrid and i want to use the arrows to navigate up and down between the lines. i also want that each row i'm in, will be marked (as in DataGrid.Select(row_number)). When my form is...
0
817
by: ray well | last post by:
hi, i need to preview the keys in my app in order to process F1-F10. i set keypreview of my form to true, and it does capture the keystroke which i can process. if the user types into the...
2
1820
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...
5
2949
by: Jeff S | last post by:
I'm creating a new Windows Forms MDI application... How can I add cause the application to shut itself down after a period of ? I did this in an old COM/VB6 application and I had to have code...
1
2779
by: Rajesh Kumar Choudhary | last post by:
Hi, I want to use the system.windows.form.datagrid control present in .net 2005 or 2003. Is it possible to use this? Please let me know if it is not supported. I have seen and used the classes...
1
3869
by: Ben | last post by:
Hi I would like to complete a task whenever F4 is pressed by the user anywhere on a form. The problem is the Key Down event does not fire for the form if the user is, for example within a...
0
7108
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
7142
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
7181
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...
1
6847
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
5445
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,...
0
3078
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1383
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
618
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.