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.

[System.Diagnostics.DebuggerNonUserCode]
[System.Serializable]
public sealed class CannotRemoveControlException : Microsoft.VisualStudio.Tools.Applications.Runtime.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