tags:

views:

40

answers:

2

I need to read data from text files and use the same in my application. Im using VB 6.0. What commands do I use? Some Sample code would be highly appreciated.

+3  A: 

A full tutorial and sample code can be found here

  Open Filename$ For Input As #FileHandle

  Do While Not EOF(FileHandle)        ' Loop until end of file
   Line Input #FileHandle, TextLine$  ' Read line into variable
    ' Your code here
  Loop

  Close #FileHandle
David Sykes
Thanks David, Andy
Jack Njiri
+1  A: 

Here's how to read an entire text file into a string - from the VB6 manual.

Open strFilename For Input As #iFile
strTheData = StrConv(InputB(LOF(iFile), iFile), vbUnicode)
Close #iFile  
MarkJ