CannotRemoveControlException Class
The exception that is thrown when code tries to remove a host control or Windows Forms control that was added to a document at design time.
Assembly: Microsoft.Office.Tools.v4.0.Framework (in Microsoft.Office.Tools.v4.0.Framework.dll)
System::Exception
Microsoft.VisualStudio.Tools.Applications.Runtime::RuntimeException
Microsoft.Office.Tools::CannotRemoveControlException
| Name | Description | |
|---|---|---|
![]() | CannotRemoveControlException() | This API supports the product infrastructure and is not intended to be used directly from your code. |
![]() | CannotRemoveControlException(Exception^) | This API supports the product infrastructure and is not intended to be used directly from your code. |
![]() | CannotRemoveControlException(String^) | This API supports the product infrastructure and is not intended to be used directly from your code. |
![]() | CannotRemoveControlException(String^, Exception^) | This API supports the product infrastructure and is not intended to be used directly from your code. |
![]() | CannotRemoveControlException(String^, String^) | This API supports the product infrastructure and is not intended to be used directly from your code. |
![]() | CannotRemoveControlException(String^, String^, Exception^) | This API supports the product infrastructure and is not intended to be used directly from your code. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object^) | (Inherited from Object.) |
![]() | GetBaseException() | (Inherited from Exception.) |
![]() | GetHashCode() | (Inherited from Object.) |
![]() | GetObjectData(SerializationInfo^, StreamingContext) | (Inherited from Exception.) |
![]() | GetType() | (Inherited from Exception.) |
![]() | ToString() | (Inherited from Exception.) |
If you add host controls and Windows Forms controls to documents that are part of document-level customizations at design time, you cannot delete these controls at run time. For more information, see Adding Controls to Office Documents at Run Time.
This exception can be thrown by the Visual Studio Tools for Office runtime if you call one of the following methods to delete a control that was added at design time:
The Remove method of a Microsoft.Office.Tools.Excel::ControlCollection object in a document-level customization for Microsoft Office Excel.
The Remove method of a Microsoft.Office.Tools.Word::ControlCollection object in a document-level customization for Microsoft Office Word.
The Delete method of a host control or Windows Forms control on a Word document or Excel workbook.
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

