CustomTaskPaneCollection.Remove 方法 (2007 system)

更新:2007 年 11 月

CustomTaskPaneCollection 中移除指定的 CustomTaskPane

命名空间:  Microsoft.Office.Tools
程序集:  Microsoft.Office.Tools.Common.v9.0(在 Microsoft.Office.Tools.Common.v9.0.dll 中)

语法

声明
Public Function Remove ( _
    customTaskPane As CustomTaskPane _
) As Boolean
用法
Dim instance As CustomTaskPaneCollection
Dim customTaskPane As CustomTaskPane
Dim returnValue As Boolean

returnValue = instance.Remove(customTaskPane)
public bool Remove(
    CustomTaskPane customTaskPane
)

参数

返回值

类型:System.Boolean

如果从集合中成功移除了 CustomTaskPane,则为 true;如果集合中不包含指定的 CustomTaskPane,则为 false。

异常

异常 条件
ArgumentNullException

customTaskPane 为 nullnull 引用(在 Visual Basic 中为 Nothing)。

ObjectDisposedException

已经对 CustomTaskPaneCollection 调用了 Dispose 方法。

备注

如果外接程序不再需要自定义任务窗格,则可以使用 Remove 方法,在外接程序仍在运行时清理任务窗格使用的资源。使用此方法时,会自动调用指定 CustomTaskPane 对象的 Dispose 方法。

Visual Studio Tools for Office 运行时会在卸载外接程序时自动清理自定义任务窗格使用的资源。不要在项目中的 ThisAddIn_Shutdown 事件处理程序中调用 Remove 方法。此方法会引发 ObjectDisposedException,因为 Visual Studio Tools for Office 运行时会在调用 ThisAddIn_Shutdown 之前清理 CustomTaskPane 对象使用的资源。

权限

另请参见

参考

CustomTaskPaneCollection 类

CustomTaskPaneCollection 成员

Microsoft.Office.Tools 命名空间