_CommandBarButtonEvents_ClickEventHandler fires multiple times

M

Markus Kraemer

Hi,

I have an outlook addin setting up a new commandbar each time a new
inspector is created (outlook 2000).
The CommandBarButtons are hold in static variables within
connect-class.
If the CommandBarButtons still exists, the found Buttons are set to
the static
variables again. Each time the inspector is launched the Click-events
are bound
to the same OnClickMethod.

My problem:
If I launch three inspectors (no matter if they are closed or not)
clicking on
a CommandBarButton will cause the OnClickMethod to be executed three
times.

I thing I've done ervery thing as descriped in microsoft sample
"Developing .NET Smart Clients for Microsoft Office XP".

What's wrong. Is it necessary to unregister the click-events each time
an
inspector is closed? I do this ony when outlook is terminated.

thanks in advance
Markus Kraemer
 
D

Dmitry Streblechenko

Set the CommandBarButton.Tag property to a unique string for each *instance*
of the button.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
M

Markus Kraemer

Thanks very much. It works ;-)

Markus Krämer


Dmitry Streblechenko said:
Set the CommandBarButton.Tag property to a unique string for each *instance*
of the button.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 

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