Export (0) Print
Expand All

HTMLWindow.Parent Property

Gets the immediate parent object of a HTMLWindow object.

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

Window Parent { get; }

Property Value

Type: EnvDTE.Window
A Window object.

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

public void CodeExample(DTE2 dte, AddIn addin)
{
   // Make sure you have an open HTML document before running this example.
    try
    {
        if (dte.ActiveDocument.ActiveWindow.Object is HTMLWindow)
        {
            HTMLWindow htmlwin;
            string msg = "";
            htmlwin = dte.ActiveDocument.ActiveWindow.Object as HTMLWindow;
            // Show the related application object's name.
            msg += "The application containing this HTMLWindow is " + htmlwin.DTE.Name;
            // Show the HTMLWindow's parent object.
            msg += "\nThe HTMLWindow's parent object is " + htmlwin.Parent.Type.ToString();
            MessageBox.Show(msg);
        }
    }
    catch(Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

Show:
© 2015 Microsoft