You can store item names in Keys enum in database like "Control+Shift+A".
You can fetch this string from database, split it with '+' char, use
Enum.Parse() method to convert it to Keys enum and combine all splitted keys
with '|' operators. This will give you the combination in Keys enum that
stored in database.

Then you can assign it to toolstripmenuItem.

You can use attached sample that explains this operation.



Best regards.


~~~~~~~~~~~~~~~~~~~~~~~~
Harun Yiğit Legoz

HyundaiAssan - Senior Software Developer

http://www.hylegoz.net
http://hylegoz.spaces.live.com


On Wed, Jun 3, 2009 at 2:24 PM, Danny <[email protected]> wrote:

>
> I have an application where it should become possible to customize the
> menu's available to the users(s).
>
> Amongst other info, I let the administrator select the values form the
> shortcut that goes with a menu he has created. This value is stored in
> the database: an OR of the Ctrl/Alt/Shift and the keycode of the
> actual key (A-Z, F1-F12, ...).
>
> The problem is that when the application loads the menus, it wont
> accept assigning a variable to the .ShortutKeys-thing of the
> ToolStripMenuItem.
> The issue is that ShortutKeys is an 'enum' and only accepts something
> like 'Keys.A', but not the value coming from the database.
>
> I could build a large Select Case around it:
> Select case dbValue
>

Attachment: KeyCombinationSample.rar
Description: application/rar

Reply via email to