471,326 Members | 2,179 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,326 software developers and data experts.

c# MenuItem.Shortcut

Hello,

I'm generating a MainMenu in c# from a dataset, and one of the fields
is the shortcut. How can I add something like this:

if (dr["SHORTCUT"].ToString() != string.Empty)
m_menuitem.Shortcut = dr["SHORTCUT"].ToString();

I'm sure that the above code doesn't work, but I'm a junior C#
developer so I need some help here...

Ideally, the column SHORTCUT should contain for example CtrlO or F4,
but I could live with for example 24, a constant referencing to an
array with shortcut enumerations, to translate for example to
Shortcut.CtrlO.

What I would like to avoid is a massive Switch statement, where I have
to test for every possible value.

Thank you for your suggestions ,

Dirk

Dec 30 '05 #1
0 2289

This discussion thread is closed

Replies have been disabled for this discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.