CannotRemoveControlException Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
public ref class CannotRemoveControlException sealed : Microsoft::VisualStudio::Tools::Applications::Runtime::RuntimeException
[System.Diagnostics.DebuggerNonUserCode]
[System.Serializable]
public sealed class CannotRemoveControlException : Microsoft.VisualStudio.Tools.Applications.Runtime.RuntimeException
[<System.Diagnostics.DebuggerNonUserCode>]
[<System.Serializable>]
type CannotRemoveControlException = class
inherit RuntimeException
Public NotInheritable Class CannotRemoveControlException
Inherits RuntimeException
- Inheritance
- Attributes
Remarks
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.