Delete Method (General Extensibility)
Deletes items as follows:
- For the Breakpoint object, deletes the breakpoint.
- For the CodeAttribute, ToolBoxItem and ToolBoxTab objects, removes an object from a collection.
- For the Command object, removes a named command that was created with
- For the Project object, removes the project from storage.
- For the ProjectItem object, removes the item from the project and its storage.
- For the SolutionConfiguration object, removes the SolutionConfiguration object from use.
- For the TaskItem object, removes the task item from the collection.
- For the WindowConfiguration object, removes the window configuration from the collection.
Public Sub Delete()
HRESULT __stdcall Delete();
public function Delete()
For the SolutionConfiguration object, the last remaining solution configuration cannot be deleted.
The following code deletes the selected code:
Sub DeleteExample() Dim objToolbox As ToolBox Dim colTbxTabs As ToolBoxTabs Dim objTab As ToolBoxTab Dim colTbxItems As ToolBoxItems Dim objTbxItem As ToolBoxItem ' Create references to the IDE's ToolBox object and ToolBoxTabs ' collection. objToolbox = DTE.Windows.Item(Constants.vsWindowKindToolbox).Object colTbxTabs = objToolbox.ToolBoxTabs objTab = colTbxTabs.Item(1) colTbxItems = objTab.ToolBoxItems ' Add a new tab to the ToolBox. objTab = colTbxTabs.Add("Sample ToolBoxTab") ' Add a couple of new ToolboxItem objects to the new tab we just added. objTbxItem = objTab.ToolBoxItems.Add("Text Item", "Hello world") objTbxItem = objTab.ToolBoxItems.Add("HTML Item", "Hello world", vsToolBoxItemFormat.vsToolBoxItemFormatHTML) ' Select the third item on the newly-created tab in the Toolbox and ' delete it. colTbxTabs.Item(1).Activate() colTbxItems.Item(3).Select() If (MsgBox("Delete the selected ToolBox item?", vbYesNo) = vbYes) Then colTbxItems.SelectedItem.Delete() End If End Sub
Applies To: Breakpoint Object | CodeAttribute Object | Command Object | Project Object | ProjectItem Object | SolutionConfiguration Object | TaskItem Object | ToolBoxItem Object | ToolBoxTab Object | VCCodeAttribute Object | WindowConfiguration Object