VB Code:
Private Sub Command1_Click() Dim strFileText As String Open "C:\Path\LogFile.txt" For Append As #1 [color=green] 'Loop throught the current file lines saving them to a string.[/color] Do While Not EOF(1) strFileText = strFileText & Input(LOF(1), 1) Loop [color=green] ' Write out the textbox values to the file.[/color] Print #1, "Record Created: " & txtDateTime.Text & _ " By: " & txtUserName.Text & vbCrLf [color=green] 'Followed by the original file's text.[/color] Print #1, strFileText Close #1 End Sub




Reply With Quote