(Ok, so It was a nalant trick to get you to read this.. so sue me...)
I want to append a text file, I want to add text to the TOP of it... how do i do that?? How do I open it and add text to the top!?!?!?
Printable View
(Ok, so It was a nalant trick to get you to read this.. so sue me...)
I want to append a text file, I want to add text to the TOP of it... how do i do that?? How do I open it and add text to the top!?!?!?
There is probably a WAY easier way to do this but since no one is posting it i thought i showed you a way that SHOULD work. What will happend is it will grab the already existent text into a string and grab the new text and add the new to the old and print into the file.
Hope that helps,Code:Dim olddata As String
Dim newdata As String
Dim everything As String
newdata = Text1.Text
Open "C:\myfile.txt" For Input As #1
Do Until EOF(1)
Line Input #1, olddata
Loop
Close #1
everything = newdata & olddata
Kill "C:\myfile.txt"
Open "C:\myfile.txt" for OutPut As #1
Print #1, everything
Close #1
D!m
If you have the old text in a textbox already, all you have to do is this:
This will add the new text, which you might have in a variable or in another text box, to the top of the textbox. I hope that is what you want.Code:Private Sub Command1_Click()
text1.text = yournewtext & text1.text
End Sub