Reference Properties of a Form

 < Free Open Study > 



Add a New Method to the End of a Module

The AddMethodToEndOfDocument method shown in the following code uses the TextDocument and EditPoint objects to place a new method at the end of the module in the active window. The module can be a class, module, or code for a form. Cursor position is of no consequence.

   Public Sub AddMethodToEndOfDocument(ByVal NewMethod As String)     Dim objTD As TextDocument = oVB.ActiveDocument.Object     Dim objEP As EditPoint = objTD.EndPoint.CreateEditPoint     ' We are past the end of the last line of the document     ' move back in front of the End Module/Class     objEP.LineUp(1)     ' if a c# file, we must get within the namespace and     ' the class braces     If Me.GetFileType(oVB.ActiveDocument) = 9 Then         objEP.LineUp(1)     End If     objEP.Insert(NewMethod)   End Sub



 < Free Open Study > 



Writing Add-Ins for Visual Studio  .NET
Writing Add-Ins for Visual Studio .NET
ISBN: 1590590260
EAN: 2147483647
Year: 2002
Pages: 172
Authors: Les Smith

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net