I have an UltraGrid control on my form that handles KeyDown events on certain cells without a problem. I am using the keydown event to enable 'Excel-like' navigation between cells/rows using the arrow keys. However, certain cells don't appear to fire the KeyDown event when the arrow keys are pressed. When they are pressed the focus moves to a different control on the form. Other keys seem to work fine, i.e. the event is fired.
The cells where this occurs have checkboxes or masked text (formatted date/time) and all are set to 'NoEdit'. I'm reasonably certain this is the root of the problem, but I've read that the UltraGrid's keydown event should still fire for these cells.
Any suggestions on what might be consuming the KeyDown message before the UltraGrid receives it?
Which keys don't fire the events? There are certain keys, like the Tab key, that are handled by the form and no control will get a KeyDown event for them.
It's also possible that your form has a toolbar or menu that is handling some keys before they get to the grid for processing.
Also... what version of the grid are you using?
Hi Mike,
The following keys don't fire the events:TabEscapeEnterPrtScnF1, F3, F5, F6Arrow keys ('standard' and num pad w/num lock off) (on certain cells)
As you said, keys like the Tab key are processed by the form (the same is probably true for Escape, Enter, PrtScn and the Function keys).
The arrow keys do fire the KeyDown event except when the cells contains something other than 'plain' text.
The grid is version 9.1.
Thanks.
Hi,
I tried this out using v8.1, v9.1, and v10.3 and it works just fine for me in all versions.
I also tried it in a normal text cell, a DateTime cell with masking, and a checkbox cell in all three versions and it works fine for me in all cases. The KeyDown event fires for both the left and right arrow key.
So either this is a bug in the specific version of the control you are using - in which case, maybe you just need to get the latest service release.
How to get the latest service release - Infragistics Community
Or, something else in your application is handling those keys before they get to the grid.
Same problem here:
Tried on Infragistics 11.2.20112.2019 Service pack.
Not able to use "F1" key press.
Am I using a wrong event? Not sure.
My sample code is below"
Private Sub UltraGrid1_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles UltraGrid1.KeyDown Dim myFileName As String = Nothing If e.KeyCode = Keys.Enter Then MsgBox("Enter Key clicked") ' This is working ElseIf e.KeyCode = Keys.F10 Then MsgBox("F1 clicked") End If End Sub
Hello Ayrus,
Your code is actually checking if you have pressed "F10" instead of "F1":
ElseIf e.KeyCode = Keys.F10 Then MsgBox("F1 clicked") End IfIf you change the Keys.F10 to Keys.F1 it should work.
Please feel free to let us know if you have any other questions with this matter.
None of this seem to be working; not sure if there any issue with my code.
Please could you evaluate below code:
Private Sub UltraGrid1_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles UltraGrid1.KeyDown If e.KeyCode = Keys.Enter Then MsgBox("Enter eydown") ElseIf e.KeyCode = Keys.F1 Then MsgBox("F1 clicked") End If
' Or
If e.KeyData = Keys.F1 Then MsgBox("F1 clicked") End If End Sub
I have tried this using NetAdvantage for Windows Forms 2011 vol2 and it works fine for me. Could you please verify that your UltraGrid has the focus when you are pressing F1, and also if it is hooked correctly to the mentioned KeyDown event ?What version of the NetAdvantage controls you are using in your application?If you have any other questions please feel free to let us know.
I am glad that everything works fine now.
If you have any other questions please feel free to let us know.
Thanks Danko. Re-installed the tool and it works fine now..
Thanks for timely response.