Events
May 19, 6 PM - May 23, 12 AM
Calling all developers, creators, and AI innovators to join us in Seattle @Microsoft Build May 19-22.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
You can add a custom task pane to the applications listed above by using VSTO Add-in. For more information, see Custom task panes.
Applies to: The information in this topic applies to VSTO Add-in projects for Outlook. For more information, see Features available by Office application and project type.
Note
Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Personalize the Visual Studio IDE.
Open or create a VSTO Add-in project for one of the applications listed above. For more information, see How to: Create Office projects in Visual Studio.
On the Project menu, click Add User Control.
In the Add New Item dialog box, change the name of the new user control to MyUserControl, and then click Add.
The user control opens in the designer.
Add one or more Windows Forms controls from the Toolbox to the user control.
Open the ThisAddIn.cs or ThisAddIn.vb code file.
Add the following code to the ThisAddIn
class. This code declares instances of MyUserControl
and CustomTaskPane as members of the ThisAddIn
class.
Add the following code to the ThisAddIn_Startup
event handler. This code creates a new CustomTaskPane by adding the MyUserControl
object to the CustomTaskPanes
collection. The code also displays the task pane.
myUserControl1 = new MyUserControl();
myCustomTaskPane = this.CustomTaskPanes.Add(myUserControl1, "My Task Pane");
myCustomTaskPane.Visible = true;
Note
This code associates your custom task pane with the active window in the application. For some applications, you might want to modify this code to ensure that the task pane appears with other documents or items in the application. For more information, see Custom task panes.
Events
May 19, 6 PM - May 23, 12 AM
Calling all developers, creators, and AI innovators to join us in Seattle @Microsoft Build May 19-22.
Register today