Export (0) Print
Expand All
Cut
Run
Expand Minimize

SmartFormat Method (EditPoint Object)

Visual Studio .NET 2003

Formats the specified range of text based on the current language.

[Visual Basic .NET]
Public Sub SmartFormat( _
   ByVal Point As TextPoint _
) 
[Visual Basic 6]
Sub SmartFormat( _
   ByVal Point As TextPoint _
) 
[C++]
HRESULT __stdcall SmartFormat(
   TextPoint* Point
);
[C#]
public void SmartFormat(
   TextPoint Point
);
[JScript .NET]
public function SmartFormat(
   Point : TextPoint
)

Parameters

Point
Required. A TextPoint object representing the end of the specified range of text.

Remarks

Smart formatting is auto-formatting of code done by the particular language. The edit point and Point are the boundaries for smart formatting. You can select smart formatting options separately for each language under the Text Editor node in the Options dialog box on the Tools menu.

The reformatting includes the lines containing the endpoints and adheres to global settings for smart formatting style (vsSmartFormatOptions).

Example

Sub SmartFormatExample()
   Dim objTextDoc As TextDocument
   Dim objMovePt As EditPoint
   Dim objEditPt As EditPoint, iCtr As Integer

   ' Create a new text file.
   DTE.ItemOperations.NewFile("General\Text File")

   ' Get a handle to the new document and create an EditPoint.
   objTextDoc = DTE.ActiveDocument.Object("TextDocument")
   objMovePt = objTextDoc.EndPoint.CreateEditPoint
   objEditPt = objTextDoc.StartPoint.CreateEditPoint

   ' Insert ten lines of text.
   For iCtr = 1 To 10
      objEditPt.Insert("This is a test." & Chr(13))
   Next iCtr
   objEditPt.StartOfDocument()
   objMovePt.EndOfDocument()
   objEditPt.SmartFormat(objMovePt)
End Sub

See Also

SmartFormat Method (TextSelection Object)

Applies To: EditPoint Object

Show:
© 2014 Microsoft