Udostępnij za pośrednictwem


CustomTaskPaneCollection.RemoveAt(Int32) Method

Definition

Removes the CustomTaskPane at the specified index of the CustomTaskPaneCollection.

public:
 void RemoveAt(int index);
public void RemoveAt (int index);
abstract member RemoveAt : int -> unit
Public Sub RemoveAt (index As Integer)

Parameters

index
Int32

The zero-based index of the CustomTaskPane to remove.

Exceptions

The collection does not contain a CustomTaskPane at index.

The Microsoft.Office.Tools.CustomTaskPaneCollection.Dispose method has already been called on the CustomTaskPaneCollection.

Remarks

If your add-in no longer requires a custom task pane, you can use the RemoveAt method to clean up resources used by the task pane while the add-in is still running. When you use this method, the <xref:Microsoft.Office.Tools.CustomTaskPane.Dispose%2A> method of the specified CustomTaskPane object is automatically called.

The Visual Studio Tools for Office runtime automatically cleans up resources used by the custom task pane when the add-in is unloaded. Do not call the RemoveAt method in the ThisAddIn_Shutdown event handler in your project. This method will throw an ObjectDisposedException, because the Visual Studio Tools for Office runtime cleans up resources used by the CustomTaskPane object before ThisAddIn_Shutdown is called.

Applies to