
Untitled
By: a guest on
Jun 9th, 2012 | syntax:
None | size: 1.50 KB | hits: 32 | expires: Never
Visual Studio 2010 Add-in Button click doesnt fire
CommandBar menuBar = ((CommandBars)_applicationObject.CommandBars)["MenuBar"];
CommandBarPopup toolsPopup = (CommandBarPopup)menuBar.Controls["Tools"];
_popupMenu = (CommandBarPopup)toolsPopup.Controls.Add(MsoControlType.msoControlPopup, Type.Missing, Type.Missing, 1, true);
popupMenu.Caption = "My Addin";
_btnRefreshProdData = (CommandBarButton)_popupMenu.Controls.Add(MsoControlType.msoControlButton, Type.Missing, Type.Missing, Type.Missing, true);
_btnRefreshProdData.Style = MsoButtonStyle.msoButtonIconAndCaption;
_btnRefreshProdData.Caption = "Refresh Product Data";
_btnRefreshProdData.Click += new _CommandBarButtonEvents_ClickEventHandler(OnRefreshProdData);
_btnRefreshProdData.Enabled = true;
_btnRefreshEngCodes = (CommandBarButton)_popupMenu.Controls.Add(MsoControlType.msoControlButton, Type.Missing, Type.Missing, Type.Missing, true);
_btnRefreshEngCodes.Style = MsoButtonStyle.msoButtonIconAndCaption;
_btnRefreshEngCodes.Caption = "Refresh Engine Codes";
_btnRefreshEngCodes.Click += new _CommandBarButtonEvents_ClickEventHandler(OnRefreshEngineCodes);
_btnRefreshEngCodes.Enabled = true;
private void OnRefreshEngineCodes(CommandBarButton Ctrl, ref bool CancelDefault)
{
MessageBox.Show("I can see this message");
}
private void OnRefreshProdData(CommandBarButton Ctrl, ref bool CancelDefault)
{
ExternalNamespace.Test test = new ExternalNamespace.Test();
test.Test();
MessageBox.Show("I can't see this message");
}