473,750 Members | 2,279 Online
Bytes | Software Development & Data Engineering Community
+ 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 1704
Hi,

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

Ken
------------------
"Carl Tribble" <ca**@tribbleso ftware.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.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***@bellsout h.net> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..
Hi,

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

Ken
------------------
"Carl Tribble" <ca**@tribbleso ftware.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.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
1128
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 which is quite 'bulky', in that it contains a potentially large DataGrid and a bunch of supporting DataSets, DataViews etc. Also on my MDI Parent form, I have a 'Windows' menu option which has the
2
1469
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 Jacksonville, Fl
3
4024
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
1687
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 loaded, my focus is on a textbox i have, and what i want to do is that if i press the arrows keys the focus will be on the dataGrid (on the next row) and while i'll navigate with arrows, the row i will be in will be totaly marked. how can i do...
0
836
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 text box of a ComboBox, the keystrokes aren't captured in the form's keypress event. likewise if the user types inside of a cell in a datagrid control the keystrokes again aren't captured in the form.
2
1828
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 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...
5
2966
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 behind practically all visible UI controls (triggered on the Mouse_Move event) that reset a global variable monitored by a timer. If the global value incremented past a certain point, then a Timer event procedure would cause a dialog to appear....
1
2796
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 from FCL using system.tlb or mscorelib.tlb from dot net framework. I could use ArrayList successfully without any issue.
1
3885
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 text box. Is there any method of doing this other than adding the code to the key down event for all controls? Thanks
0
8999
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8836
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9575
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9338
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9256
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6803
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4885
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3322
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 we have to send another system

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.