Duplicate CustomTaskPane Windows - Help!

P

Paulem0071

During debugging of my Outlook 2007 CustomTask Pane, sometimes it appears
twice in outlook. How do i prevent this from happenng. Have tried all
varieties of:

//see if already loaded

if (CustomTaskPanes.Count > 0)
{
foreach (Microsoft.Office.Tools.CustomTaskPane ctp in
this.CustomTaskPanes)
{
if (ctp.Title == "My Add-In")
{
//use it
myCustomTaskPane = ctp;

//this.CustomTaskPanes.Remove(ctp);
}

}
}
else
{
//make a new one
taskPane = new MyCustomTaskPane();
myCustomTaskPane = this.CustomTaskPanes.Add(taskPane, "My
Add-In");
}

Thank you.
 
K

Ken Slovak - [MVP - Outlook]

This is what, a VSTO addin? Please provide all relevant information.

You should be using the second overload for CustomTaskPanes.Add(), where you
supply the window to the method.

That way each task pane you add is targeted to a specific window and won't
appear in any other window. Otherwise you might get 3 task panes showing if
you have 3 items open at once.
 

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