473,767 Members | 2,284 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
Nov 21 '05 #1
2 1829
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

Nov 21 '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

Nov 21 '05 #3

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

Similar topics

0
1129
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
1705
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...
3
2154
by: max | last post by:
I can generate this error by NOT assigning a tableName to the view: at System.Windows.Forms.DataGrid.AddNewRow() at System.Windows.Forms.DataGridAddNewRow.OnEdit() Is there any possibility of getting an event from the AddNewRow()? I would like to make some changes to the row prior to the user typing in the DataGrid. Thanks,
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
4027
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
1688
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.
5
2967
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
2797
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
3886
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
9571
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
9404
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
10009
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9838
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
7381
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
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3929
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
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.