Click here to Skip to main content
16,017,954 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to read second line of the file using vb6.
Open "C:\test.txt" For Binary As #1
myfile = Space$(LOF(1))
Get #1, , myfile
This code is used to read whole file but i want to read line by line like first line,second line.
Help me..?
Posted
Comments
ChandraRam 20-Oct-11 15:33pm    
When it is a binary file, there is no concept of "line by line". Do you want to read a text file?

Btw, you should probably be using VB.Net instead of VB6 now.

1 solution

If you are reading a text file, don't read it as a binary file, read it as a text file.

I got this from a post found www.dreamincode.net forums:


Read this, it'll give you a lot of information on reading text files (and you'll learn about 'Line Input' which takes entire lines and ignores commas):

http://www.dreaminco...wtopic29575.htm


Here's a tutorial on strings and their handy functions (including the Len() function which you'll wanna use to get the length of the lines):

http://www.dreaminco...wtopic13107.htm

If you still can't figure it out, post again but this time with your code and also explaining any errors you're encountering.
 
Share this answer
 
Comments
Espen Harlinn 25-Oct-11 16:46pm    
A couple of good vb6 links in there, my 5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900