Michael
It is preferable to use the methods in File and Directory classes of
System.IO to manipulate files, rather than using scripting (ie.
FileSystemObject)
eg
Imports System.IO
If Directory.Exists("...") Then
.....
End If
Stephen
"Michael" <mi*****@hotmail.com> wrote in message
news:05****************************@phx.gbl...
-----Original Message-----
"Michael" <mi*****@hotmail.com> wrote in message
news:0d****************************@phx.gbl... Hello all and thanks in advance,
I'm running a vb.net program and part of it copies files
from one server to another.
It generally works fine but once in a while I get this
error:
System.InvalidCastException: QueryInterface for interface Scripting.IFileSystem3 failed.
at Scripting.FileSystemObjectClass.FolderExists (String FolderSpec)
the line it fails at looks like this:
If fso.FolderExists(srcDir2) Then
...
End IF
Could some one please give me some insight as to why this error keeps poping up.
Thanks,
Michael
Am I missing something or are you still using the
Scripting COM objects? Ifyou are, you should really consider using the System.IO
namespace. It willbe much easier.
Jeremy
.
I am using the System.IO namespace....
This error shows up in a
try...
catch e As exception ...
end try
statement.
Also fso is set as a New FileSystemObject
Michael