This documentation is archived and is not being maintained.

HtmlTextWriter.OutputTabs Method

Writes a series of blank characters that represent the tab spacing for a line of HTML characters.

[Visual Basic]
Protected Overridable Sub OutputTabs()
[C#]
protected virtual void OutputTabs();
[C++]
protected: virtual void OutputTabs();
[JScript]
protected function OutputTabs();

Remarks

This method uses the integer passed to the HtmlTextWriter.Indent property to determine how many spaces to write for the tab spacing.

If no indent is indicated, the HtmlTextWriter object uses the DefaultTabString constant (\t).

Example

[Visual Basic, C#, C++] The following example shows a custom HtmlTextWriter class, MyHtmlTextWriter, that overrides the FilterAttributes and OutputTabs methods. The overridden OutputTabs method gets the value assigned to the Indent property and uses this value to determine how many DefaultTabString entries to write. The overridden FilterAttributes method sets the Indent property to 3 and then calls the overridden OutputTabs method, generating three tab spaces.

[Visual Basic] 
' Override the OutputTabs method to tab the number
' of spaces defined by the Indent variable.

Protected Overrides Sub OutputTabs()
   ' Output the 'DefaultTabString' for 'Indent' number of times.
   Dim i As Integer
   For i = 0 To Indent - 1
      Write(DefaultTabString)
   Next i
   MyBase.OutputTabs()
End Sub 'OutputTabs

[C#] 
// Override the OutputTabs method to tab the number
// of spaces defined by the Indent variable.

protected override void OutputTabs()
{
   // Output the 'DefaultTabString' for 'Indent' number of times.
   for(int i = 0; i < Indent; i++)
      Write(DefaultTabString);
   base.OutputTabs();
}

[C++] 
// Override the OutputTabs method to tab the number
// of spaces defined by the Indent variable.
 protected:
 
void OutputTabs() {
   // Output the 'DefaultTabString' for 'Indent' number of times.
   for (int i = 0; i < Indent; i++)
      Write(DefaultTabString);
   __super::OutputTabs();
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

HtmlTextWriter Class | HtmlTextWriter Members | System.Web.UI Namespace

Show: