J
J e r
I'm a novice using VB .NET . I'm trying to use 2 files to read a line write
the line and get the run time error
"..exception of type 'System.IO.IOException.....additional information:
File already open."
It seems the error message is telling me VB can have only 1 file open at a
time. Tell me that's not true and where
I'm going wrong, please.
The code is:
Imports System.IO.File
..
..
..
..
private sub bRun_Click(byval sender as System.Object, byval e as
System.Event.Args) handles bRun.Click)
dim infil as integer = FreeFile()
dim outfil as integer = FreeFile()
dim infilname as string = "c"\red.txt"
dim outfilname as string = "c"\wrt.txt"
dim inline as string
FileOpen(outfil, outfilname,OpenMode.Output)
FileOpen(infil,infilname,OpenMode.Input) 'this is where error
occurs
while not eof(infil)
inline = LineInput(infil)
PrintLine(outfil,inline)
end while
FileClose(infil)
FileClose(outfil)
end sub
Thanks for your time, J e r
the line and get the run time error
"..exception of type 'System.IO.IOException.....additional information:
File already open."
It seems the error message is telling me VB can have only 1 file open at a
time. Tell me that's not true and where
I'm going wrong, please.
The code is:
Imports System.IO.File
..
..
..
..
private sub bRun_Click(byval sender as System.Object, byval e as
System.Event.Args) handles bRun.Click)
dim infil as integer = FreeFile()
dim outfil as integer = FreeFile()
dim infilname as string = "c"\red.txt"
dim outfilname as string = "c"\wrt.txt"
dim inline as string
FileOpen(outfil, outfilname,OpenMode.Output)
FileOpen(infil,infilname,OpenMode.Input) 'this is where error
occurs
while not eof(infil)
inline = LineInput(infil)
PrintLine(outfil,inline)
end while
FileClose(infil)
FileClose(outfil)
end sub
Thanks for your time, J e r