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
 
* "Armin Zingler said:
io.file.exists(filename)

.... that should be forbidden with 'Option Strict On' too!
'System.IO.File.Exists' ;-).
 
Herfried K. Wagner said:
... that should be forbidden with 'Option Strict On' too!
'System.IO.File.Exists' ;-).

I don't see the difference.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top