hi,
i got this code -
Code:
--------------------
CommandBar menuBar = applicationObject.CommandBars["MenuBar"];
CommandBarControl m_TemplatesControl = menuBar.Controls.Add(MsoControlType.msoControlPopup,1,"",System.Reflection.Missing.Value,true);
m_TemplatesControl.Visible = true;
m_TemplatesControl.OnAction = "MyFuncName";
--------------------
the problem is that it never being called...
i want that when i press the control it will call the function
(it's popup and not button bcuz it got more commands inside it...)
help please,
Avi.
Carlos J. Quintero [.NET MVP] - 14 Feb 2005 10:21 GMT
You can either cast the CommandBarControl to CommandBarButton and trap its
Click event or you can set an event handler to CommandBarControl with
objDTE.Events.CommandBarEvents(CommandBarControl). But AFAIK the OnAction
property does not fit in the new "Option Strict On" age of VB.NET... ;-)

Signature
Carlos J. Quintero
MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
> hi,
> i got this code -
[quoted text clipped - 16 lines]
> help please,
> Avi.
"Ed Dore [MSFT]" - 14 Feb 2005 23:58 GMT
Hi Avi,
One thing to try might be to ensure that you scope the CommandBarControl a
bit differently. It looks like this is a local variable that will go out of
scope, and it could be that this is why you are not seeing the event fire.
Typically an addin will make this a member of the object that implements
IExtensibility2.
However, I have not attempted to use this OnAction property before, so
Carlos sugestion might be a better way to go.
Sincerely,
Ed Dore [MSFT]
This post is "AS IS" with no warranties, and confers no rights.