|
-
May 27th, 2005, 02:45 PM
#16
Hyperactive Member
Re: Reading form text file
I run VB6 at work and had that same problem the other day. The reason you get that array error when using the split function is because split turns the variable into an array using a delimiter to make distinctions between elements. An example is:
dim fso as FileSystemObject
dim myTextStream as TextStream
dim myReadText() as String
set fso = New FileSystemObject
set myTextStream = fso.OpenTextFile("C:\File.txt")
myReadText = Split(myTextStream.ReadLine, "|") 'The "pipe" symbol is the divider of the text
MsgBox (myReadText(0))
MsgBox (myReadText(1))
MsgBox (myReadText(2))
This is just an example. The split function turns the variable into an array. So make sure you dim that variable accordingly.
I hope this helps.
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
|