This documentation is archived and is not being maintained.

DTE Object

Visual Studio .NET 2003

The top-level object in the Visual Studio automation object model.


[Visual Basic .NET]
Public Class DTE
[Visual Basic 6]
Class DTE
class DTE
public class DTE
[JScript .NET]
public class DTE


The DTE object is provided to you by the OnConnection Method that you implement when you create an Add-in. The DTE object is the Application object in Visual Basic.

To access project-specific properties such as VBProjects or CSharpProjects, use the syntax DTE.GetObject("VBProjects").

For details about referencing the EnvDTE namespace and the DTE object, see Referencing the DTE Object.


Namespace: EnvDTE

File: dte.olb


Sub DTEExample()
  Dim objTextDoc As TextDocument
  Dim objEP As EditPoint
  'Create a new text document.
  DTE.ItemOperations.NewFile("General\Text File")
  'Get a handle to the new document.
  Set objTextDoc = DTE.ActiveDocument.Object("TextDocument")
  Set objEP = objTextDoc.StartPoint.CreateEditPoint
  'Create an EditPoint and add some text.
  objEP.Insert "A test sentence."
End Sub

See Also

DTE Object Properties, Methods, and Events | DTE Property (General Extensibility) | DTEEvents Object | DTEEvents Property | Referencing the DTE Object