|
-
June 28th, 2001, 01:10 PM
#1
Read All Data From A Text File
Is there an easy way to read all the data in a text file into a string, without looping and
reading each line to build the string? I thought you could do it with the FileSystemObject but
I can't seem to find how.
Thanks for any help.
Kris
Software Engineer
Phoenix,AZ
Kris
Software Engineer
Phoenix, AZ USA
-
June 28th, 2001, 01:37 PM
#2
Re: Read All Data From A Text File
you can use a stream object and issue a ReadText. The stream object is available is you are using ADO 2.6
dim str as string
Dim ts as Stream
set ts = new Stream
ts.LoadFromFile {filename}
str = ts.readtext
set ts = nothing
-
June 28th, 2001, 04:43 PM
#3
Re: Read All Data From A Text File
The following sample will read a text file into a variable called Text1.text
' Read a file into a TEXT box using binary read
' this reduces the exposure of VB editing double quote marks and
' commas out of the text
private Sub Command1_Click()
Dim a
a = "C:\to DO LIST\1.txt"
Open a for binary as #1
Text1.Text = input(FileLen(a), #1)
Close
End Sub
John G
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
|