Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
 How to: Add a Custom Task Pane to a...
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
Visual Studio Tools for the Microsoft Office System
How to: Add a Custom Task Pane to an Application

Note Required applications

The features in this topic are available only if you have the required applications installed.

For more information, see Features Available by Product Combination.

  • One of these development environments:

    VSTO 2005

    -or-

    Visual Studio Team System

    -or-

    Visual Studio 2005 Professional Edition

  • VSTO 2005 SE installed in the development environment

  • 2007 Microsoft Office system

You can add a custom task pane to some applications in the 2007 Microsoft Office system by using an application-level add-in. For more information, see Custom Task Panes Overview.

video For a video demonstration, see Video: Adding Custom Task Panes to 2007 Office Applications Using Visual Studio 2005 Tools for Office SE.

NoteNote

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, select Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

Adding a Custom Task Pane to an Application

To add a custom task pane to an application

  1. Open or create an application-level project for an application in the 2007 Microsoft Office system. For more information, see How to: Create Visual Studio Tools for Office Projects.

    NoteNote

    Microsoft Office Visio 2007 does not support custom task panes. For more information, see Custom Task Panes Overview.

  2. On the Project menu, click Add User Control.

  3. In the Add New Item dialog box, change the name of the new user control to MyUserControl, and click Add.

    The user control opens in the designer.

  4. Drag one or more Windows Forms controls from the Toolbox to the user control.

  5. Open the ThisAddIn.cs or ThisAddIn.vb code file.

  6. Add the following code to the ThisAddIn class. This code declares an instance of MyUserControl as a member of ThisAddIn.

    Visual Basic
    Private myUserControl1 As MyUserControl
    
    C#
    private MyUserControl myUserControl1;
    
  7. Add the following code to the ThisAddIn_Startup event handler. This code adds the MyUserControl object to the CustomTaskPanes collection and displays the custom task pane.

    Visual Basic
    myUserControl1 = New MyUserControl
    Dim myCustomTaskPane As Microsoft.Office.Tools.CustomTaskPane = _
        Me.CustomTaskPanes.Add(myUserControl1, "My Task Pane")
    myCustomTaskPane.Visible = True
    
    C#
    myUserControl1 = new MyUserControl();
    Microsoft.Office.Tools.CustomTaskPane myCustomTaskPane =
        this.CustomTaskPanes.Add(myUserControl1, "My Task Pane");
    myCustomTaskPane.Visible = true;
    

See Also

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker