This worked for me:
Private Sub Command1_Click()
Open "c:\test.txt" For Append As #1
Print #1, Text1
Close #1
MsgBox "Text saved"
End Sub
Private Sub Form_Load()
On Error GoTo errhandler
Open "c:\test.txt" For Input As #1
Do Until EOF(1)
Line Input #1, linein
Text1 = Text1 & linein
Loop
Close #1
Exit Sub
errhandler:
MsgBox "File does not exist"
End Sub
If you want to save the enter key or other special keys, you have to save
it as a binary file.
You can also use richtextbox control which can both load a file and save
to a file.
Hope this helps
Seth
> Hi I want to load a txt file the at text to it then save it. Then I want
> to be able to open the program again and have it load the new file so
that
> I can add more text to the text box. How do I get it to do that?
>
> Private Sub Form_Load()
> Open "C:\myfile.txt" For Input As #1
>
> Close #1
>
> End Sub
>
> Private Sub Command1_Click()
> Open "C:\myfile.txt" For Append As #1
> Print #1, Text1.Text
> Close #1
> End Sub
>
>
> This did not work I lose the text when I start over the program.
> Nigel..