Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

text boxes to text files

Status
Not open for further replies.

RumpleBear

Programmer
May 26, 2002
6
AU
i was wondering how to save multiple text boxes into one text file and bring it all back again into the same txt boxes [afro]
 
Here is a suggestion, which assumes that the textboxes has an control array.

Save
------------------------------------------------------------
Dim OutFile As Byte, i As LogEventTypeConstants
OutFile = FreeFile
If Dir(&quot;c:\tmp\test.txt&quot;) <> &quot;&quot; Then Kill &quot;c:\tmp\test.txt&quot;
Open &quot;c:\tmp\test.txt&quot; For Binary Access Write As #OutFile
For i = 0 To Text1.Count - 1
Put #OutFile, , Text1(i).Text & &quot;¬&quot;
Next i
Close #OutFile
------------------------------------------------------------

Load
------------------------------------------------------------
Dim InFile As Byte, MyStr As String
Dim MyArr() As String, i As Long
InFile = FreeFile
Open &quot;c:\tmp\test.txt&quot; For Binary Access Read As #InFile
MyStr = Space(LOF(InFile))
Get #InFile, , MyStr
Close #InFile
MyArr = Split(MyStr, &quot;¬&quot;)
For i = 0 To Text1.Count - 1
Text1(i).Text = MyArr(i)
Next i
------------------------------------------------------------
Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top