Edit a Menu in a component using Visual Studio

  • Thread starter Thread starter Jeronimo Bertran
  • Start date Start date
J

Jeronimo Bertran

Hi,

If I add a menu (or context menu) to a component class by dragging it from
the toolbox, it is added correctly but I can't find a way to edit it. The
Edit Menu command appears in the context menu for the item but it doesn't
seem to do anything.

Thanks,

Jeronimo Bertran
 
Hi Jeronimo,

Thanks for your post!!

Based on my understanding, you want to use ContextMenu and MainMenu in your
Winform applicaiton, but you do not know how to edit these 2 menu
components in VS.net IDE. If I misunderstand you, please feel free to tell
me. Thanks

If we drag a MainMenu component onto the VS.net designer, it will appear on
the component tray just below the designer Form. When we select the
MainMenu component in the component tray, the text "Type Here" is displayed
in the Form Designer just below the caption bar, click the displayed text,
and type the name of the desired menu item to add it.
To add another menu item, click another "Type Here" area within the Menu
Designer.
1. Click the area to the right of the current menu item to add a submenu.
-or-
2. Click the area below the current menu item to add another entry to the
same menu.

Then, the edited MainMenu component is associated with the current form.

For ContextMenu, the edit way is almost the same with MainMenu component.
But to associate the context menu with the form or a control on the form,
we should set that control's ContextMenu property in the Properties window.
Once the setting is done, we can run the winform application, and when we
right click that control, our context menu will display out.

For more information, you may refer to the below official document:
"Adding Menus and Menu Items to Windows Forms"
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/
vbtskaddingmenusitemstomenu.asp
"Editing Names of Menu Items for Windows Forms"
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/
vbtskeditingnamesofmenus.asp
"Adding Context Menus to Windows Forms"
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/
vbtskaddingcontextmenustoform.asp

Hope this helps
==================================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi Jeffrey..

The problem is that I am trying to add the menus to a component and NOT to
a form.

From my project, I add a new item and select Component Class. I then drag
a menu to the component.

I am able to add the menu to the component but since a component does not
have a desginer form, I can't find a way to edit it. The reason I want to
add a menu to a component is that I want to create a "predefined" menu that
can be added to multiple forms by dragging it from the toolbox.


Thanks again,

Jeronimo Bertran
 
Hi Jeronimo,

Thanks for your feedback!!

With your further statement, I think I understand your problem much better
now.

Oh, I do not think this is a suitable way of getting what you want. I think
we should create a customized MyMainMenu component, which inherits from the
MainMenu class. Then we can extend the MainMenu class's functions. But, we
can only extend the MainMenu class's function through code in .cs file, not
through the Visual Designer. This is recommended way of extending a
component's function.
=====================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi Jeronimo,

Does my reply make sense to you? If you still have concern on this issue,
please feel free to feedback. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top