Reading text from file using ReadLine method

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I am getting a problem using the following piece of code:

Dim strfile As Object
Set strfile = FSO.OpenTextFile(stFilePath, 1)
Do While Not strfile.AtEndOfStream
strtext = strfile.ReadLine
Loop

Whenever the character count of the line goes in excess of 130, only the
131st character onwards are displayed. Any pointers?

CD
 
This snippet of code is completely late bound and is using the old Scripting
Runtime Library methods to read the file. You should use the objects
provided in the System.IO namespace if you are programming with .Net. Take
a look at the StreamReader object.

--Robby
 
Hi,
Thanks for the advice but i am programming in VB6.0 and not in .NET, so
unfortunately i cannot use the methods in System.IO namespace.
I would be happy if you could let me know if the ReadLine method
encounters some problem when the length of the line is more than 131 chars
and how i can overcome it.

Thanks
CD
 
CD,

This is a VBNet newsgroup.
Although the the name is as well VB it has almost completly different code.

For VB classic there are a lot of newsgroups.

microsoft.public.vb*

The most active is as far as I know

microsoft.public.vb.generaldiscussions.

I hope this helps?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top