473,850 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting ShortCut property for MenuItems

I have a table (about 50 rows that populate the variables shown below in
lines 1 and 2) of shortcuts that I would like to read into a Windows Form.
The following code would work with one big exception:

CType will not convert a string to a MenuItem. (Line 3)

Dim MyShortCut As Integer = 13122 '13122 is integer for Ctrl2
Dim MyMenuItem As String = "MenuItem12 "
Dim oMnu As Windows.Forms.M enuItem = CType(MyMenuIte m,
Windows.Forms.M enuItem)
Dim oSC As Windows.Forms.S hortcut = CType(MyShortCu t,
Windows.Forms.S hortcut)
oMnu.Shortcut = oSC

Is there a way to read and dynamically set this property from a table using
a different approach?
Nov 21 '05 #1
2 1300
genojoe wrote:
I have a table (about 50 rows that populate the variables shown below in
lines 1 and 2) of shortcuts that I would like to read into a Windows Form.
The following code would work with one big exception:

CType will not convert a string to a MenuItem. (Line 3)

Dim MyShortCut As Integer = 13122 '13122 is integer for Ctrl2
Dim MyMenuItem As String = "MenuItem12 "
Dim oMnu As Windows.Forms.M enuItem = CType(MyMenuIte m,
Windows.Forms. MenuItem)

Try this:

Dim oMnu as New Windows.Forms.M enuItem(MyMenuI tem, MyEventHandler,
MyShortcut)

or, set the shortcut after just setting the text.

Tom
Dim oSC As Windows.Forms.S hortcut = CType(MyShortCu t,
Windows.Forms. Shortcut)
oMnu.Shortcut = oSC

Is there a way to read and dynamically set this property from a table using
a different approach?

Nov 21 '05 #2
I could not make it work. Thanks for the effort.

"tomb" wrote:

Try this:

Dim oMnu as New Windows.Forms.M enuItem(MyMenuI tem, MyEventHandler,
MyShortcut)

or, set the shortcut after just setting the text.

Tom

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
378
by: Luke Wright | last post by:
Hi, I have built a setup project to install an application I am developing. I would like to be able to prompt the user whether to install Shortcuts in the following locations: * Start Menu * Desktop * Quick Launch I have added a UI page that has three checkboxes on it to
4
8864
by: Salad | last post by:
A97. If you set a forms properties to ShortcutMenu = No, the entire form is disabled from displaying a shortcut menu. If you set the property to Yes, all controls have a shortcut menu. I have a form that I would like a shortcut menu on 1 control and no shortcut on any other control in the form. But the controls that have no shortcut display a default shortcut. Access help states " If you set the ShortcutMenuBar property to a value
0
2801
by: Marcel | last post by:
Hi, the application I am writing has a MainMenu and a DataGrid (UltraGrid). Now I have to edit the text of each cell in this grid. So far so good. All works fine in editmode but if I press a key which is also a shortcut it doesn´t work and the menuitem-clickevent will be performed.
15
2479
by: Jeff Mason | last post by:
I have an application where I need to set certain menu items invisible based on a user privilege. We did a sinmlar thing in VB6 and used the menu item's tag property to assign an identifier to each menu entry, then used that identifier as an index into a collection populated at user login in order to determine the item's visibility. Now, for some reason there's no tag property for .NET MenuItems, so I'm looking for some way to...
1
1856
by: Björn Dietz | last post by:
Hello all, I'm just testing the VS2005 beta. I've added a MenuStrip with some MenuItems in it, these I furnished with a "ShortcutKeyDisplayString". I was expecting that when I press that key during runtime, the application should start the desired action behind the corresponding MenuItems (in my case it's just a boring Application.Exit, which is in the MenuItem.Click-Event), but it doesn't seem to work that way. What did I do wrong?
6
3354
by: Charleees | last post by:
Hi all, I have a DropDown and a TextBox just bekeow it... I have to get the selected value from dropdown and set it as textBox Text.. The thing is i have to do this Without PostBack..... Is there any java script to do this functionality...
3
1540
by: Mike Edgewood | last post by:
Is there a simple way, shortcut, or macro to create a property skeletons? I would live to be able to type a name and a type and have the property created based on that info. Private mLastName as String Public Property LastName() as String Get Return mLastName
2
1941
by: diego | last post by:
hi everyone, i have a sub that opens a form given the form's name as string and opens it using System.Reflection. How can I set the form's properties at runtime. Here is my code. Public Sub OpenForm(ByVal cFormName) Dim frm As Object Dim frmType As Type
12
1565
by: NithyaVijayAnnanth | last post by:
Hi, I am new to vb.net I have a problem with mdiform menuitems enabled property.How to enable or disable the menuitems in mdiform from another form.The condition is that when the mdiform loads all the menuitems should be disabled after the logon is true all the menuitems should be enabled. Please let me know how to do this. Advanced thanks
0
9895
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10670
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10725
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9503
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7900
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5735
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5931
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4547
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3178
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.