Hi there,
I am Embeza from ethiopia,Mekele
Here i got a problem!
It says " file path not found"
while i was working on vb 6.0 in my lab on files
the following was my code and can you fix plz

Option Explicit
Dim var as string 
Dim inputFile as string
Dim outputFile as string
Dim x as integer
 
Private Sub cmdReadfromFile_click()
Open inputFile For input as #x
   x=freeFile()
While not eof(x)
   input #x,var
  Wend
label1.caption=var
Close #x
End sub
 while not eof(1)

Recommended Answers

All 3 Replies

Hi Embeza ,
In the following code you had sent,there is no value assigned to Inputfilevariable
And you have to use function Freefile before opening file
mean
Syntax of Reading Files is

x = freefile() Assigning the new file number which ever is exists

Open (filename with Path) for (Mode-Input/Output) as #Filenumber
While Not Eof(Filenumber)

Wend

Hi Embeza ,

Freefile should be used before opening of file
it is used to assign next existed filenumber


Syntax of Reading Files is

x = freefile()
Open (filename with Path) for (Mode-Input/Output) as #Filenumber

While Not Eof(Filenumber)
Line Input #Filenumber,StringVariable

Wend
Label1.caption = Stringvariable
Close #filenumber

In the above example take x as Filenumber as per your code

Hi maheshsayani,
I thank you very much for your targetable reponse
good luck
Embeza

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.