Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Visual Basic 2005 Basics
|
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 16th, 2006, 05:08 AM
Registered User
 
Join Date: Oct 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Setting a menu shortcut with .ShortcutKeys

:( VB 2005 prblem :(

I'm trying to set a shortcut (Ctrl+D) to a menu item using the syntax:

   MenuItem.ShortcutKeys = Keys.ControlKey + Keys.D

I get an error message claiming: "The value of argument 'value' (85) is invalid for Enum type 'Keys'."

The VB 2005 help for ShortcutKeys does not show what values to use and their example of how to set Ctrl+O is a blank space!!

Trawling the NET has brought up a blank so here I am - asking for clues again. I know I am doing something wrong but I don't know what.

All the best,
              HotBlue (Very Blue)


 
Old October 16th, 2006, 07:13 AM
Authorized User
 
Join Date: May 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The correct syntax to do is :

MenuItem.ShortcutKeys = CType(Keys.Control + Keys.D, Keys)

 
Old October 16th, 2006, 07:33 AM
Registered User
 
Join Date: Oct 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Thanks HaveHave2222,

It works a treat.

This VB 2005 is very daunting and IMHO far to complex to achieve relatively simple tasks.
Having said that - it does have some outrageously powerful features!

All the best,
               HotBlue.







Similar Threads
Thread Thread Starter Forum Replies Last Post
CH 15 Context Menu - Element Menu Items Razzy The Pug BOOK: Ivor Horton's Beginning Visual C++ 2005 2 November 9th, 2008 03:53 PM
the default shortcut menu is displayed instead of ayazhoda Access VBA 2 May 15th, 2008 04:19 AM
how create menubar, menu, menu item in xsl vijayanmsc XSLT 1 June 5th, 2006 06:43 AM
Menu shortcut keys not working! ebs Access 0 December 22nd, 2004 07:57 AM
Changing Menu made with VB 4 Menu Editor Zooker VB How-To 1 July 26th, 2003 11:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.