|
-
September 26th, 2011, 03:28 AM
#7
Re: Shortcut key problems
xem = 49; // ascii code for 1
while (drC.Read())
{
ToolStripMenuItem mnu = new ToolStripMenuItem();
mnu.Text = drC[1].ToString();
mnu.ToolTipText = "Cupon";
// displays the Shortcut Key
char c = (char)xem;
mnu.ShowShortcutKeys = true;
mnu.ShortcutKeyDisplayString = c.ToString();
// the problem is that I want to assign the key to the menu item
mnu.ShortcutKey = xem (integer) -> convert to Keys. 1 - 9; (enum Keys)
contextMenuStripDatagridView.Items.Add(mnu);
xem = xem+1;
}
The itemclicked event of the contextual menu is already defined - I just need to dynamically assign shortcut key based on the integer (ASCII code) - 1 to 9 keys.
FROM INTEGER to Key
Last edited by arhicoc; September 26th, 2011 at 03:30 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|