ContentControlBase.Delete Method (2007 System)

Deletes a dynamically created content control from the document and removes it from the ControlCollection in the document.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)

Syntax

'Declaration
Public Sub Delete ( _
    deleteContent As Boolean _
)
'Usage
Dim instance As ContentControlBase 
Dim deleteContent As Boolean

instance.Delete(deleteContent)
public void Delete(
    bool deleteContent
)
public:
void Delete(
    bool deleteContent
)
public function Delete(
    deleteContent : boolean
)

Parameters

  • deleteContent
    Type: System.Boolean

    true to delete the contents of the control; false to leave the contents of the control in the document.

Exceptions

Exception Condition
CannotRemoveControlException

The content control was added to the document at design time.

Remarks

This method should only be used to delete a content control that is created programmatically at run time. An exception is thrown if you call this method on a content control that is added to the document at design time.

.NET Framework Security

See Also

Reference

ContentControlBase Class

ContentControlBase Members

Microsoft.Office.Tools.Word Namespace

Other Resources

Content Controls

How to: Add Content Controls to Word Documents

Adding Controls to Office Documents at Run Time