|
-
Oct 30th, 2000, 09:03 PM
#1
Thread Starter
Lively Member
(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!?!?!?
___________________________
Chris
-
Oct 31st, 2000, 12:26 AM
#2
Fanatic Member
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.
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
Hope that helps,
D!m
-
Oct 31st, 2000, 11:22 AM
#3
PowerPoster
If you have the old text in a textbox already, all you have to do is this:
Code:
Private Sub Command1_Click()
text1.text = yournewtext & text1.text
End Sub
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|