CustomTaskPaneCollection.Add Method (UserControl, String, Object) (2007 System)
Creates a new CustomTaskPane and adds it to the current CustomTaskPaneCollection. The custom task pane is based on the specified UserControl, has the specified title, and is associated with the specified application window.
Namespace: Microsoft.Office.Tools
Assembly: Microsoft.Office.Tools.Common.v9.0 (in Microsoft.Office.Tools.Common.v9.0.dll)
Syntax
'Declaration
Public Function Add ( _
control As UserControl, _
title As String, _
window As Object _
) As CustomTaskPane
'Usage
Dim instance As CustomTaskPaneCollection
Dim control As UserControl
Dim title As String
Dim window As Object
Dim returnValue As CustomTaskPane
returnValue = instance.Add(control, title, _
window)
public CustomTaskPane Add(
UserControl control,
string title,
Object window
)
public:
CustomTaskPane^ Add(
UserControl^ control,
String^ title,
Object^ window
)
public function Add(
control : UserControl,
title : String,
window : Object
) : CustomTaskPane
Parameters
control
Type: System.Windows.Forms.UserControlA UserControl that provides the user interface for the new custom task pane.
title
Type: System.StringThe text that appears in the title bar of the new custom task pane.
window
Type: System.ObjectAn object that represents the application window to associate the new custom task pane with.
Return Value
Type: Microsoft.Office.Tools.CustomTaskPane
A CustomTaskPane that represents the new custom task pane.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | control or title is nulla null reference (Nothing in Visual Basic). |
ObjectDisposedException | The Dispose method has already been called on the CustomTaskPaneCollection. |
Remarks
Use this method to create a new CustomTaskPane that is associated with a specific application window. This method is useful if you want to create custom task panes that are visible with multiple Inspectors or Explorers in Outlook, or with multiple documents in Word or InfoPath. For more information, see Managing Custom Task Panes in Multiple Application Windows.
The type of the window parameter depends on the application. The following table lists the valid types of the window parameter.
Application |
Parameter type |
---|---|
Word 2007 |
|
Excel 2007 |
|
PowerPoint 2007 |
Microsoft.Office.Interop.PowerPoint.DocumentWindow |
InfoPath 2007 |
|
Outlook 2007 |
-or- |
Although the CustomTaskPaneCollection class is a collection of CustomTaskPane objects, the Add method accepts UserControl objects instead of CustomTaskPane objects. For more information, see Custom Task Panes Overview.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
CustomTaskPaneCollection Class
CustomTaskPaneCollection Members
Microsoft.Office.Tools Namespace