Hook menu item event

B

BC

Hello,

I successfully display an add-in menu. However,
when I try to hook the message item to the event
handler, I receive this compiler error message:

(291): Method 'MyAddIn.Connect.MenuItem_Click
(Office.CommandBarButton, ref bool)' does not match
delegate 'void
Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHan
dler(Microsoft.Office.Core.CommandBarButton, ref bool)'


// myAddin code
private Office.CommandBarButton MenuItem = null;

private void MenuItem_Click(Office.CommandBarButton Ctrl,
ref Boolean CancelDefault)
{
MessageBox.Show("BC Menu Item");
}

MenuItem.Click += new
Microsoft.Office.Core.
_CommandBarButtonEvents_ClickEventHandler(MenuItem_Click);


Any ideas?

TIA,
BC
 
J

Jacques

Hi BC,

Try this:
MenuItem1.Click += new
Office._CommandBarButtonEvents_ClickEventHandler
(MenuItem1_Click);

IHTH,
Jacques
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top