Duplicate CustomTaskPane Windows - Help!

  • Thread starter Thread starter Paulem0071
  • Start date Start date
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.
 
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.
 
Back
Top