By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,594 Members | 2,062 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,594 IT Pros & Developers. It's quick & easy.

Not working shortcut key when Datagrid has focus

P: 4
hi
I am working on window appication.
and i have put a shortcut key for different action like say F1 is press then new record etc like that

now when i have focus in datagrid i am getting keydown when working in datagrid cell so i am not getting which key is pressed and am not able to make my shortcut working.
plz give me some solution
Nov 23 '06 #1
Share this Question
Share on Google+
2 Replies


sivadhas2006
100+
P: 142
Hi,

Can you post your code?

Check the Form Design Time KeyPreview Property.

Regards,
M.Sivadhas.
Nov 23 '06 #2

P: 4
Hi,

Can you post your code?

Check the Form Design Time KeyPreview Property.

Regards,
M.Sivadhas.
Here is code for u.
In the forms load event i added hanler for handling keydown event
AddHandler CType(dgcharge.TableStyles(0).GridColumnStyles(1), DataGridTextBoxColumn).TextBox.KeyDown, AddressOf txtChargecode_KeyDown


And here is my key down event
Select Case e.KeyCode
Case Keys.F1
cmdnew_Click(cmdnew, e)
Case Keys.F2
cmdmodf_Click(cmdmodf, e)
Case Keys.F3
cmdsave_Click(cmdsave, e)
Case Keys.F4
cmdcancl_Click(cmdcancl, e)
Case Keys.F5
cmdDelete_Click(cmdDelete, e)
Case Keys.F12
cmdexit_Click(cmdexit, e)
End Select
Nov 25 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.