This documentation is archived and is not being maintained.

HTMLWindow.CurrentTab Property

Gets or sets the state (active or inactive) of the Source or the Designer tab in the HTML edit window.

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

vsHTMLTabs CurrentTab { get; set; }
/** @property */
vsHTMLTabs get_CurrentTab ()

/** @property */
void set_CurrentTab (/** @attribute InAttribute() */ vsHTMLTabs pTab)

function get CurrentTab () : vsHTMLTabs

function set CurrentTab (pTab : vsHTMLTabs)

Property Value

A vsHTMLTabs constant indicating the active tab:

public void CurrentTabExample(_DTE dte)
    // Open an HTML document before running this sample.
    if (dte.ActiveDocument.ActiveWindow.Object is HTMLWindow)
        HTMLWindow objHTMLWin;
        vsHTMLTabs Tab;
        String strFileName;
        // Ask the user for a file to insert into the body of the HTML 
        // document. This file should be an HTML fragment.
        strFileName = Microsoft.VisualBasic.Interaction.InputBox 
        ("Enter the name of a file to insert at the end of the HTML 
        // Get the HTMLWindow object and determine which tab is 
        // currently active.
        objHTMLWin = dte.ActiveDocument.ActiveWindow.Object as 
        Tab = objHTMLWin.CurrentTab;

        // Switch to the "source" tab.
        objHTMLWin.CurrentTab = vsHTMLTabs.vsHTMLTabsSource;

        // Get an EditPoint at the start of the text.
        TextWindow objTextWin;
        EditPoint ep;
        EditPoint ep2 = null;
        TextRanges textRanges = null;
        objTextWin = objHTMLWin.CurrentTabObject as TextWindow;
        ep = objTextWin.ActivePane.StartPoint.CreateEditPoint();
        textRanges = objTextWin.Selection.TextRanges;

        // Look for the end of the document body.
        if (ep.FindPattern 
        ("</body>",(int)vsFindOptions.vsFindOptionsNone, ref ep2, ref 
            // Insert the contents of the file.
            ep.InsertFromFile (strFileName);
            // Switch back to the original view of the HTML file.
            objHTMLWin.CurrentTab = Tab;
            MessageBox.Show ("You must open an HTML document.");