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.
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.
Hi,
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.
Thanks Danko. Re-installed the tool and it works fine now..
Thanks for timely response.
I am glad that everything works fine now.
If you have any other questions please feel free to let us know.