I got this from the archives here at P2P....
Dim nFile As Integer
nFile = FreeFile
Open "c:\data\test.txt" For Binary Access Write As #nFile
Put #nFile, , Text1.Text
Close #nFile
Restore the saved text and put it in the TextBox with:
Dim nFile As Integer
nFile = FreeFile
Open "c:\data\test.txt" For Binary Access Read As #nFile
Text1.Text = Input(LOF(nFile), #nFile)
Close #nFile
> I can save a txt file and load it later, but if I have
>
> Hello there
> How are you.
>
> When I load the text file on form load it reads
>
> Hello ThereHow are you.
>
> I was told that I would have to save text1.text as a binary file how do
I
> do that. My code is:
>
> 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
>
> Private Sub Command1_Click()
> Open "c:\test.txt" For Append As #1
> Print #1, Text1
> Close #1
> MsgBox "Text saved"
>
> End Sub
>
> How would I change the code to save as a binary file?
> errhandler:
> MsgBox "File does not exist"