CustomTaskPaneCollection.RemoveAt 方法

移除 CustomTaskPaneCollection 之指定索引中的 CustomTaskPane

命名空間:  Microsoft.Office.Tools
組件:  Microsoft.Office.Tools.Common (在 Microsoft.Office.Tools.Common.dll 中)

語法

'宣告
Sub RemoveAt ( _
    index As Integer _
)
void RemoveAt(
    int index
)

參數

例外狀況

例外狀況 條件
ArgumentOutOfRangeException

此集合未包含 index 中的 CustomTaskPane

ObjectDisposedException

已經在 CustomTaskPaneCollection 上呼叫過 Dispose() 方法。

備註

如果增益集不再需要自訂工作窗格,您可以在增益集仍執行時使用 RemoveAt 方法清除工作窗格所使用的資源。 當您使用這個方法時,會自動呼叫指定之 CustomTaskPane 物件的 Dispose() 方法。

當增益集卸載時,Visual Studio Tools for Office Runtime 會自動清除自訂工作窗格使用的資源。 請不要在專案的 ThisAddIn_Shutdown 事件處理常式中呼叫 RemoveAt 方法。 此方法會擲回 ObjectDisposedException,因為 Visual Studio Tools for Office Runtime 會在呼叫 ThisAddIn_Shutdown 之前先清除 CustomTaskPane 物件使用的資源。

.NET Framework 安全性

請參閱

參考

CustomTaskPaneCollection 介面

Microsoft.Office.Tools 命名空間