This documentation is archived and is not being maintained.

Indent Method

Visual Studio .NET 2003

Indents the selected lines by the given number of indentation levels.

[Visual Basic .NET]
Public Sub Indent( _
   Optional ByVal Point As TextPoint = Nothing, _
   Optional ByVal Count As Integer = 1 _
[Visual Basic 6]
Sub Indent( _
   Optional ByVal Point As TextPoint = Nothing, _
   Optional ByVal Count As Int = 1 _
HRESULT __stdcall Indent(
   TextPoint* Point,
   int Count
public void Indent(
   TextPoint Point,
   int Count
[JScript .NET]
public function Indent(
   Point : TextPoint,
   Count : int


Optional. A TextPoint object endpoint for indentation. The default is the current line in the buffer, causing the current line in the buffer to be indented.
Optional. The number of displayed columns to indent the lines. The default value is 1.


Indent indents the lines bounded by the edit point and Point, including the lines that contain the endpoints. Each line indents the given number of indentation levels. One indentation level is the number of display columns determined by the global editor's setting. Indent does not perform smart formatting or indent lines based on the context of the code. Smart formatting is auto-formatting of code done by the particular language. You can select smart formatting in each language node of the Options command on the Tools menu.

Tabs and spaces are inserted, depending on whether the global setting is set to use tabs when indenting. The indentation may consist of multiple tab and space characters, depending on the number of spaces a tab equals in the global setting.

If Count is negative, then Indent performs similarly to Unindent.

Indent fails if Count is greater than or equal to 10,000.


Sub IndentExample()
  'Before running this example, open a text document.
  Dim objTD As TextDocument
  Dim objEP As EditPoint

  objTD = DTE.ActiveDocument.Object("TextDocument")
  objEP = objTD.StartPoint.CreateEditPoint
End Sub

See Also

Applies To: EditPoint Object | EditPoint Example 1