This documentation is archived and is not being maintained.

HtmlTextWriter Constructor

.NET Framework 1.1

Initializes a new instance of the HtmlTextWriter class.

Overload List

Initializes a new instance of the HtmlTextWriter class that uses the DefaultTabString constant when indentation of a line is necessary.

[Visual Basic] Public Sub New(TextWriter)
[C#] public HtmlTextWriter(TextWriter);
[C++] public: HtmlTextWriter(TextWriter*);
[JScript] public function HtmlTextWriter(TextWriter);

Initializes a new instance of the HtmlTextWriter class with the line indentation as specified in the tabString parameter.

[Visual Basic] Public Sub New(TextWriter, String)
[C#] public HtmlTextWriter(TextWriter, string);
[C++] public: HtmlTextWriter(TextWriter*, String*);
[JScript] public function HtmlTextWriter(TextWriter, String);

Example

[Visual Basic] The following code example overrides the CreateHtmlTextWriter method and calls this version of the HtmlTextWriter constructor with an indent of five spaces. The constructor is from a custom HtmlTextWriter class, named CstmHtmlTW.

[Visual Basic] Note   This example shows how to use one of the overloaded versions of the HtmlTextWriter constructor. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
Public Class CustomPage
   Inherits Page
  
  ' Override the Page.CreateHtmlTextWriter method to create
  ' an instance of a custom HtmlTextWriter, FirstSimpleHtmlTextWriter,
  ' with the (TextWriter, string) constructor. 
  Protected Overrides Function CreateHtmlTextWriter(writer As TextWriter) _
      As HtmlTextWriter
   
      ' Indent the page content by five spaces 
      Return New FirstSimpleHtmlTextWriter(writer, "     ")
  End Function 'CreateHtmlTextWriter
End Class 'CustomPage

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

See Also

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

Show: