CannotRemoveControlException Class

Definition

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
CannotRemoveControlException
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:

Constructors

CannotRemoveControlException()
CannotRemoveControlException(Exception)
CannotRemoveControlException(String)
CannotRemoveControlException(String, Exception)
CannotRemoveControlException(String, String)
CannotRemoveControlException(String, String, Exception)

Applies to