This documentation is archived and is not being maintained.

SmartFormat Method (TextSelection Object)

Visual Studio .NET 2003

Formats the selected lines of text based on the current language.

[Visual Basic .NET]
Public Sub SmartFormat() 
[Visual Basic 6]
Sub SmartFormat() 
HRESULT __stdcall SmartFormat();
public void SmartFormat();
[JScript .NET]
public function SmartFormat()


Re-indents or formats the selected text, including the lines the anchor and active ends are on, according to global settings for smart indenting. SmartFormat causes the selection to include the complete lines at the ends.


Sub SmartFormatExample()
   ' Before running this example, open a code document.
   Dim objSel As TextSelection = DTE.ActiveDocument.Selection
   ' Select all code in open document.
   ' Apply smart formatting rules for the language.
End Sub

See Also

Applies To: TextSelection Object