SelectionChange Event stops firing

O

Omar Shahine

I have an Outlook Addin in C# running against 2003 and have an
interesting problem.

I register for this event:

Application.ActiveExplorer().SelectionChange +=new
ExplorerEvents_10_SelectionChangeEventHandler(OnSelectionChange);

and it works fine until I use any .NET addin (be it mine or NewsGator
etc) that displays a Windows Forms (like a dialog) or an
OpenFolderDialog etc. On the second occurence of the dialog appearing
the event stops firing till I quit and relaunch Outlook.

Any ideas?

-Omar
 
D

Dmitry Streblechenko \(MVP\)

Store Application.ActiveExplorer as a class member to keep it referenced at
all times:

m_Explorer = Application.ActiveExplorer();
m_Explorer.SelectionChange +=new
ExplorerEvents_10_SelectionChangeEventHandler(OnSelectionChange);


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

Omar Shahine

Sorry if I wasn't clear. Application for me is a static variable.
However, I changed to using a private member variable with the same
results. Event stops working.
 
D

Dmitry Streblechenko \(MVP\)

I did not mean Application, but Explorer. Doesn't really matter how you
store it as long as it is explicitly referenced at all times.

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