Click here to Skip to main content
15,893,508 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I need to set shortcuts for forms. normally we can set shortcuts using form_keydown event.


Now I want to fix the shortcuts from DB.


Assume Ctrl+Alt+P is set to a form.

I can read the value from DB. now i am having "Ctrl+Alt+P" in a string Variable.

How can We assign this as shortcut for a certain form???



Thanks & Regards,
Pal
Posted

 
Share this answer
 
Comments
Wendelius 11-May-12 11:29am    
Good link!
Maciej Los 11-May-12 11:46am    
Thank you ;)
Sandeep Mewara 12-May-12 5:53am    
Good link1 5!
Maciej Los 12-May-12 6:01am    
Thank you ;)
If you store the shortcuts in the database as a string, you can split the string based on + character and then map each element to proper enumeration in Keys[^].

As you have already done, use the KeyPreview property set to true and check for shortcuts in proper form event.

However, I feel that storing the shortcuts as text in the database is a bit awkward. Could you should consider a different kind of table design, for example shortcut key and 'boolean' columns for ALT, SHIFT etc or even use the Keys enumerations, possibly as rows instead of columns....
 
Share this answer
 
Comments
Maciej Los 11-May-12 11:52am    
Good answer, my 5!
Wendelius 11-May-12 13:56pm    
Thanks :)
Sandeep Mewara 12-May-12 5:53am    
Nice suggestion. 5!
Wendelius 12-May-12 6:04am    
Thanks :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900