Bagikan melalui


_DTE Interface

The top-level object in the Visual Studio automation object model. Refer to _DTE for this functionality. Do not instantiate from this class.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
<GuidAttribute("04A72314-32E9-48E2-9B87-A63603454F3E")> _
Public Interface _DTE
'Usage
Dim instance As _DTE
[GuidAttribute("04A72314-32E9-48E2-9B87-A63603454F3E")]
public interface _DTE
[GuidAttribute(L"04A72314-32E9-48E2-9B87-A63603454F3E")]
public interface class _DTE
public interface _DTE

Remarks

The _DTE object is provided 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 How to: Get References to the DTE and DTE2 Objects.

Examples

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

Reference

_DTE Members

EnvDTE Namespace

Other Resources

Referencing Automation Assemblies and the DTE2 Object