|
-
Nov 7th, 2000, 11:21 AM
#1
Thread Starter
Addicted Member
Hi,
All I want to do is to open a file for reading using the FileSystemObject yet somehow I seem to be missing something somewhere! I keep getting the error 'Input past end of line' in the following code:
Code:
Public Sub Increase(vFileName As String)
Dim FSO As New FileSystemObject
Dim ProjectPath As String
Dim vFile As File
Dim Exists As Boolean
Dim TXT As TextStream
Dim strTemp As String
ProjectPath = FSO.BuildPath(App.Path, vFileName)
Exists = FSO.FileExists(ProjectPath)
If Exists Then
Set vFile = FSO.GetFile(ProjectPath)
Set TXT = vFile.OpenAsTextStream(ForReading)
strTemp = TXT.ReadAll '<<--Error occurs here
TXT.Close
End If
End Sub
Any help would be appreciated
cheers
Shaun
Web/Application Developer
VB6 Ent (SP5), Win 2000,SQL Server 2000
-
Nov 7th, 2000, 11:48 AM
#2
Fanatic Member
Hi Shaun,
I just read in MSDN that the ReadAll method can be memory hungry, I am currently (as we speak ) running it on an 8mb text file, it worked fine on 1/2 a meg, so I thought i'd try and kill it . What sort of file are you opening? and how big is it?
Crispin
VB6 ENT SP5
VB.NET
W2K ADV SVR SP3
WWW.BLOCKSOFT.CO.UK
[Microsoft Basic: 1976-2001, RIP]
-
Nov 7th, 2000, 11:52 AM
#3
Thread Starter
Addicted Member
Hi,
Thanks for the reply Crispin. I can appreciate that but the file that I am trying to open contains a whole '6 LINES'.
All I am trying to do is open it to read (i will work out the writing bit later!! ).
And before anybody says to use GET and PUT etc.. I want to get it to work with the FSO. 
What am I doing wrong???????
Cheers
Shaun
Web/Application Developer
VB6 Ent (SP5), Win 2000,SQL Server 2000
-
Nov 7th, 2000, 11:54 AM
#4
Fanatic Member
Crispin
VB6 ENT SP5
VB.NET
W2K ADV SVR SP3
WWW.BLOCKSOFT.CO.UK
[Microsoft Basic: 1976-2001, RIP]
-
Nov 7th, 2000, 12:00 PM
#5
Thread Starter
Addicted Member
Oooops
Hi Crispin,
Thanks for your help. I was just about to mail it to you when I realised that the text file actually contained no text!!! 
It must have got deleted when I was messing about with the 'ForReading','ForWriting' parameter!
Must be time to go home!!!!!!!!!!!!!!!
Cheers
Shaun
Web/Application Developer
VB6 Ent (SP5), Win 2000,SQL Server 2000
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
|