Export (0) Print
Expand All

ItemOperations Object

Visual Studio .NET 2003

Object for performing common file actions.

DTE

   ItemOperations

[Visual Basic .NET]
Public Interface ItemOperations
    Inherits IDispatch
[Visual Basic 6]
Class ItemOperations
[C++]
interface ItemOperations : IDispatch
[C#]
public interface ItemOperations : IDispatch
[JScript .NET]
public interface ItemOperations extends IDispatch

Remarks

You can use the ItemOperations object to programmatically open or add items to your solution and projects. Note that ItemOperations methods act upon only the currently selected item.

Requirements

Namespace: EnvDTE

File: dte.olb

Example

This example uses the ItemOperations object to generate a text document listing all available command names.

Sub ItemOperationsExample()
   Dim Cmds As Commands = DTE.Commands
   Dim Cmd As Command
   Dim Doc As Document
   Dim TxtDoc As TextDocument

   DTE.ItemOperations.NewFile("General\Text File")
   Doc = ActiveDocument
   TxtDoc = Doc.Object("TextDocument")

   For Each Cmd In Cmds
      If (Cmd.Name <> "") Then
         TxtDoc.Selection.Text = Cmd.Name & vbLf
         TxtDoc.Selection.Collapse()
      End If
   Next
End Sub

See Also

ItemOperations Object Properties, Methods, and Events

Show:
© 2014 Microsoft