Share via


Documents.Parent Property

Gets the immediate parent object of a Documents collection.

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

Syntax

'Declaration
ReadOnly Property Parent As DTE
'Usage
Dim instance As Documents 
Dim value As DTE 

value = instance.Parent
DTE Parent { get; }
property DTE^ Parent {
    DTE^ get ();
}
function get Parent () : DTE

Property Value

Type: EnvDTE.DTE
A DTE object.

Remarks

The Parent property returns the immediate parent to the object or collection.

Examples

public void Example(DTE2 dte)
{
   try
   {
      // Run this code after opening a project with at least one document.
      Documents docs;

      // Return the documents collection in the current application instance.
      docs = dte.Documents;

      // Show the number of open documents in the current application.
      MessageBox.Show(docs.Count.ToString());

      // Show the parent object of the current docs collection.
      MessageBox.Show(docs.Parent.FullName);
   }
   catch (Exception ex)
   {
      MessageBox.Show(ex.Message);
   }
}

.NET Framework Security

See Also

Reference

Documents Interface

Documents Members

EnvDTE Namespace

Other Resources

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