Inserting text at the beginning of a text file
Ok,
Todays questions of the day is two fold.
1) I need to insert a line of text into the begining of an already existing document but Append of course puts it at the end, how do you get it at the beginning.
2) My code is below for the problem I am having with #1. What is the .NET way of doing what I am trying to do?
VB Code:
Private Sub Modify_Logon_Script()
Dim logonscript As String
Dim logonscript_template As String
' Defines the logonscript and template.
logonscript_template = "logon.template"
logonscript = "data\logon.vbs"
' Grabs the share path from the text box and sets up the variable
strSharePath = ("strShareName = " & """" & txtSharePath.Text & """")
' Copies the template for the logon script to the data directory
FileCopy(strPath & "xrxlogon.template", strDataPath & "xrxlogon.vbs")
' Opens the logon script for editing
FileOpen(5, logonscript, OpenMode.Append)
' Writes the share path to the logon script
Print(5, strSharePath)
' Closes the logon script
FileClose(5)
End Sub ' Modifies the logon script with the correct path name