Share via


Find.DTE Property

Gets the top-level extensibility object.

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

Syntax

'Declaration
ReadOnly Property DTE As DTE
DTE DTE { get; }
property DTE^ DTE {
    DTE^ get ();
}
abstract DTE : DTE
function get DTE () : DTE

Property Value

Type: EnvDTE.DTE
A DTE object.

Remarks

In Visual Studio, the DTE object is the root of the automation model, which other object models often call "Application".

Examples

public void Example(DTE2 dte)
{
   try
      {
      TextDocument objTextDoc;
      EditPoint objEditPoint;
      Find objFind;

      // Make an active text document before running this code.
      objTextDoc = (TextDocument)dte.ActiveDocument.Object("TextDocument");

      // Create editpoint.
      objEditPoint = objTextDoc.StartPoint.CreateEditPoint();
      objEditPoint.Insert("An additional line" + (Char)13);

      // Create Find.
      objFind = objTextDoc.DTE.Find;

      // Set Find options and execute.
      objFind.Action = vsFindAction.vsFindActionFind;
      objFind.FindWhat = "line";
      if (objFind.Execute() == vsFindResult.vsFindResultFound)
         MessageBox.Show("Text found in " + objFind.Parent.FullName + " application.");
      else
         MessageBox.Show("Text not found" + objFind.Parent.FullName + " application.");

      // Show Find object DTE property.
      MessageBox.Show(objFind.DTE.Name);
   }
   catch (Exception ex)
   {
      MessageBox.Show(ex.Message);
   }
}

.NET Framework Security

See Also

Reference

Find Interface

EnvDTE Namespace

Other Resources

How to: Compile and Run the Automation Object Model Code Examples