Export (0) Print
Expand All
ID
Top
Expand Minimize

CurrentTabObject Property

Visual Studio .NET 2003

Returns or sets whether the Source or the Designer tab in the HTML edit window is active.

[Visual Basic .NET]
Public Property CurrentTab() As vsHTMLTabs
[Visual Basic 6]
Property Get CurrentTab() As vsHTMLTabs
Property Let CurrentTab( _
   ByVal NewValue As vsHTMLTabs _
) 
[C++]
HRESULT __stdcall get_CurrentTab(
   /* [out, retval] */ vsHTMLTabs* retVal
);
HRESULT __stdcall put_CurrentTab(
   /* [in] */ vsHTMLTabs NewValue
);
[C#]
public vsHTMLTabs CurrentTab {get; set;}
[JScript .NET]
public function get CurrentTab() : vsHTMLTabs
public function set CurrentTab(
   NewValue : vsHTMLTabs
)

Remarks

If the current tab in the HTML edit window is the Source tab, the object returned is a TextSelection object. If the current tab is the Design tab, the object returned is an IHTMLDocument2 object.

Example

Sub CurrentTabObjectExample()
   ' 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

Applies To: HTMLWindow Object

Show:
© 2014 Microsoft