Windows Develop Bookmark and Share   
 index > Windows Forms Designer > There is already a command handler for the menu command '5efc7975-14bc-11cf-9b2b-00aa00573819 : 15'.
 

There is already a command handler for the menu command '5efc7975-14bc-11cf-9b2b-00aa00573819 : 15'.

Hi,

I have implemented my own custom designer. Therefore I have also implemented my own version of a MenuCommandService which is inherited from MenuCommandService. In the
constructor of my MenuCommandService I add new command:

public CustomMenuCommandService(IServiceProvider serviceProvider)
: base(serviceProvider)
{
MenuCommand escapeCommand = new MenuCommand(new EventHandler(ExecuteEscape), MenuCommands.KeyCancel);
base.AddCommand(escapeCommand);

MenuCommand undoCommand = new MenuCommand(new EventHandler(ExecuteUndo), StandardCommands.Undo);
base.AddCommand(undoCommand);

MenuCommand redoCommand = new MenuCommand(new EventHandler(ExecuteRedo), StandardCommands.Redo);
base.AddCommand(redoCommand);

.......... and so on


After the BeginLoad call of the surface I get the following exception:

There is already a command handler for the menu command '5efc7975-14bc-11cf-9b2b-00aa00573819 : 15'.

I think this is because I added new MenuCommands - but how can I fix that issue - any ideas??

Cheers,
Franz




F. Gsell  Monday, March 19, 2007 9:59 AM

Hi,

Right, this is because you are adding a command that already exists. What you can do is first use the menucommandservice to find the command in question. Store it off, then call RemoveCommand on it, and then add your own. When you are going away you can use the stored command to readd it to the menucommandservice.

Martin

Martin Thorsen - MSFT  Tuesday, March 20, 2007 12:52 AM

Hi,

Right, this is because you are adding a command that already exists. What you can do is first use the menucommandservice to find the command in question. Store it off, then call RemoveCommand on it, and then add your own. When you are going away you can use the stored command to readd it to the menucommandservice.

Martin

Martin Thorsen - MSFT  Tuesday, March 20, 2007 12:52 AM
hi,

I'm making a VSTO project (WordAddIn) in visual studio 2008 SP1. I've designed a ribbon, while designing there were no problems at all. After that I've made another form. Now every time i click on the tab: "myRibbon.vb [Design]" that messagebox appears: "There is already a command handler for the menu command '5efc7975-14bc-11cf-9b2b-00aa00573819 : 26'." But I can still build en debug my addin, it's just an annoying messagebox.
Can anyone explain me how to let this messagebox disappear? i don't really get the method from the previous post from Martin Thorsen

Jellytron  Wednesday, September 02, 2009 8:39 PM

You can use google to search for other answers

Custom Search

More Threads

• How to covert the customized Windowns form to XHTML?
• Custom User Control
• Non Rectangular Shapes
• DropDownList SelectedIndexChanged not firing
• Stylesheet in WinForm
• Nullable type in property grid
• Dynamic TabControls and Tabpages
• VS Crashes upon exit
• How to update the editing status of a Control in a DesignSurface?
• Using MSSQL server at run time for Crystal Reports