Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

HTMLWindow Object

Visual Studio .NET 2003

Represents an HTML document window.

DTE

   Windows

      Window

         HTMLWindow

[Visual Basic .NET]
Public Interface HTMLWindow
    Inherits IDispatch
[Visual Basic 6]
Class HTMLWindow
[C++]
interface HTMLWindow : IDispatch
[C#]
public interface HTMLWindow : IDispatch
[JScript .NET]
public interface HTMLWindow extends IDispatch

Remarks

This object is returned by the Object property of the Window object when the document is an HTML document. Window.Selection returns a TextSelection object when HTMLWindow.CurrentTab is set to vsHTMLTabsSource, as does Document.Selection.

Requirements

Namespace: EnvDTE

File: dte.olb

Example

Sub HTMLWindowExample()
   ' Open an HTML document before running this sample.
   If TypeOf ActiveDocument.ActiveWindow.Object Is HTMLWindow Then
      ' Ask the user for a file to insert into the body of the HTML 
      ' document. This file should be an HTML fragment.
      Dim strFile As String = InputBox("Enter the name of a file to insert at the end of the HTML document:")
      ' Get the HTMLWindow object and find out which tab is currently 
      ' active.
      Dim objHTMLWin As HTMLWindow = ActiveDocument.ActiveWindow.Object
      Dim Tab As vsHTMLTabs = objHTMLWin.CurrentTab

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

      ' Get an EditPoint at the start of the text.
      Dim objTextWin As TextWindow = objHTMLWin.CurrentTabObject
      Dim objEP As EditPoint = objTextWin.ActivePane.StartPoint.CreateEditPoint

      ' Look for the end of the document body.
      If objEP.FindPattern("</body>") Then
         ' Insert the contents of the file.
         objEP.InsertFromFile(strFile)
      End If

      ' Switch back to the original view of the HTML file.
       objHTMLWin.CurrentTab = Tab
   Else
      MsgBox("You must open an HTML document.")
   End If
End Sub

See Also

Properties, Methods, and Events | TextDocument Object

Show:
© 2015 Microsoft