473,749 Members | 2,384 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

No keydown event fires in a datagrid

I have a Datagrid that is inside a panel. I want to use the keyDown event to
reconize the arrow keys. But I have no luck at all. The problem is that the
keydown event won't fire at all, unless I click on a row (withs will turn
blue then) and then click on it again . Now if I press any key the event will
fire (except for the arrow keys).

I also tried to override the IsInputKey => no luck.
I also tried to override the ProcessCmdKey => With this I can atleast
capture the arrow keys but I still can't get the datagrid.keydow n event to
fire unless I call the event in de ProcessCmdKey but I don't think this is
the way to do it.

Does anyone know why the keydown event won't fire in a datagrid ?

Bardo
Nov 16 '05 #1
3 9233
I believe you have that problem because when you run your program the focus
is not on your data grid (explayning why when you click on it it will process
the messages). You should try placing focus on the data grid when your form
is created.

"bardo" wrote:
I have a Datagrid that is inside a panel. I want to use the keyDown event to
reconize the arrow keys. But I have no luck at all. The problem is that the
keydown event won't fire at all, unless I click on a row (withs will turn
blue then) and then click on it again . Now if I press any key the event will
fire (except for the arrow keys).

I also tried to override the IsInputKey => no luck.
I also tried to override the ProcessCmdKey => With this I can atleast
capture the arrow keys but I still can't get the datagrid.keydow n event to
fire unless I call the event in de ProcessCmdKey but I don't think this is
the way to do it.

Does anyone know why the keydown event won't fire in a datagrid ?

Bardo

Nov 16 '05 #2
I tested the focus (using the focus enter and leave events) but the focus is
not the problem. I click on the Datagrid. Then in the datagrid I use the
arrow keys to move up and down thru the records, but no keydown event is
fired. The only way I can get the key events to fire is when I click with the
mouse on a record (row) and make it blue. Now I click on it again and now I
get the keydown event. Seems there are 2 focusses in the datagrid. But I find
this strange.

I will try some other tests and see what happens.

"Aleksandar Mraović" wrote:
I believe you have that problem because when you run your program the focus
is not on your data grid (explayning why when you click on it it will process
the messages). You should try placing focus on the data grid when your form
is created.

"bardo" wrote:
I have a Datagrid that is inside a panel. I want to use the keyDown event to
reconize the arrow keys. But I have no luck at all. The problem is that the
keydown event won't fire at all, unless I click on a row (withs will turn
blue then) and then click on it again . Now if I press any key the event will
fire (except for the arrow keys).

I also tried to override the IsInputKey => no luck.
I also tried to override the ProcessCmdKey => With this I can atleast
capture the arrow keys but I still can't get the datagrid.keydow n event to
fire unless I call the event in de ProcessCmdKey but I don't think this is
the way to do it.

Does anyone know why the keydown event won't fire in a datagrid ?

Bardo

Nov 16 '05 #3
Short update:

Using the processCmdkey I found out that when you use the arrow keys to
navigate thru the rows ,the datgrid loses focus. But the datagrid.focusl eave
event will not fire. I don't know if this is done on purpose or is maybe a
design flaw.

"bardo" wrote:
I tested the focus (using the focus enter and leave events) but the focus is
not the problem. I click on the Datagrid. Then in the datagrid I use the
arrow keys to move up and down thru the records, but no keydown event is
fired. The only way I can get the key events to fire is when I click with the
mouse on a record (row) and make it blue. Now I click on it again and now I
get the keydown event. Seems there are 2 focusses in the datagrid. But I find
this strange.

I will try some other tests and see what happens.

"Aleksandar Mraović" wrote:
I believe you have that problem because when you run your program the focus
is not on your data grid (explayning why when you click on it it will process
the messages). You should try placing focus on the data grid when your form
is created.

"bardo" wrote:
I have a Datagrid that is inside a panel. I want to use the keyDown event to
reconize the arrow keys. But I have no luck at all. The problem is that the
keydown event won't fire at all, unless I click on a row (withs will turn
blue then) and then click on it again . Now if I press any key the event will
fire (except for the arrow keys).

I also tried to override the IsInputKey => no luck.
I also tried to override the ProcessCmdKey => With this I can atleast
capture the arrow keys but I still can't get the datagrid.keydow n event to
fire unless I call the event in de ProcessCmdKey but I don't think this is
the way to do it.

Does anyone know why the keydown event won't fire in a datagrid ?

Bardo

Nov 16 '05 #4

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

Similar topics

0
1455
by: CoderOfBugs | last post by:
I am developing an IE Toolbar that has a combo box. The combox box doesn't fire the KeyDown event when the {Backspace} key is pressed. Very strange. The event fires for {Delete}, {Space}, {CTRL}, etc. Does it have something to do with {Backspace} being the hot key for going to the previous page? Code: this.cboSearch.KeyDown += new KeyEventHandler(this.cboSearch_KeyDown); private void cboSearch_KeyDown (object sender, KeyEventArgs e)
0
435
by: ChrisB | last post by:
I'm attempting to open a new window from a LinkButton in a DataGrid. I can set a session variable in the ItemCommand event for the LinkButton like so: // this is used to handle the ItemCommand event private void itmCmd(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { string itemGFNo = ""; if (e.CommandName == "EditTask")
4
10702
by: Roger | last post by:
I have a datagrid and would like to know what even fires when a cell is changed? I want to know when the user changes a cell and moves to the next. I have some code that needs to be done to make sure entry is valid? Thanks, Rog
2
6136
by: John Huang | last post by:
I would like to use datagrid's keydown event to capture the "Ctrl+D" when users press this key. But it did not work. What did I miss? (I have already set the form keypreview to true) Private Sub grdInCategory_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles grdInCategory.KeyDown If e.Control And e.KeyCode = Keys.D Then If MsgBox("Are you sure to delete the record ?", MsgBoxStyle.YesNo) =...
8
1345
by: Peter Proost | last post by:
Hi, this is my (simplified) situation: I have got 3 forms and one usercontrol: their names are: container (startup object),myform,another, mycontrol contair has got IsMdiContainer set to true, a mainmenu with a menuitem,
2
1499
by: blue_nirvana | last post by:
Is there an event that fires when a user clicks the plus sign in a Master/Detail datagrid? It would be even better if I could catch when the user clicks the link to see the detail records. What I'm wanting to do is not load the detail data until the user clicks the link. Any ideas or links would be appreciated. Thanks
14
7447
by: Brett Romero | last post by:
I'm using a DataGrid and have assigned this.DataSourceChanged += new EventHandler( DataGrid_DataSourceChanged ); This works fine but there is one case where it doesn't. How can I check if DataSourceChanged has anything assigned. I can add it to the watch because it says it needs to be on the left side of a -= or +=. Thanks,
0
1535
by: arlie_maija | last post by:
Hey - I'm writing a control that contains a DataGrid, and I'm unable to get the update event to fire. When I click the update link, the edit event fires. heres the details... my control overrides CreateChildControls and dynamically creates the DataGrid, creates an EditCommandColumn which it adds to the
5
3029
by: ApexData | last post by:
This follows a previous post, when I was trying to capture a key pressed during the immediate opening of a form (ie in the first 3-secs before processing any of the code that followed it. It was mentioned that the KeyDown event fires the instant a key is pressed down. So, if you place the following code in a form, you'll see my concern.
0
8996
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
9388
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
9254
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
6800
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
6078
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
4608
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3319
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
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
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.