How do you determine if a file exists before using the StranmReader object?

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

Guest

Is there any better method of determining if a file exists then using the Scripting.FileSystemObject

If I do thi

Dim fs As New System.IO.StreamReader(FileName

and the file does not exist thena n exception is thrown, how can you determine if the file exists before attemptng to open it
 
Hi Herfried,
... that should be forbidden with 'Option Strict On' too!
'System.IO.File.Exists' ;-).

Vb is not case sensitive and let's keep it that way

Cor
 
Cor,

* "Cor Ligthert said:
Vb is not case sensitive and let's keep it that way

I didn't "complain" about case sensitivity but about "qualification" of
a class name with an incomplete namespace hierarchy.
 
Herfried K. Wagner said:
Cor,



I didn't "complain" about case sensitivity but about "qualification"
of a class name with an incomplete namespace hierarchy.

System is imported by default.
 
Herfried,

Sorry I am such a superdummy

:-)))))))))))))))

(Of course I did understand what you mean but that answer would come from
Armin as it was)

Cor
 
Back
Top