473,657 Members | 2,572 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System.InvalidC astException error...

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.InvalidC astException: QueryInterface for interface
Scripting.IFile System3 failed.
at Scripting.FileS ystemObjectClas s.FolderExists( String
FolderSpec)
the line it fails at looks like this:

If fso.FolderExist s(srcDir2) Then
....
End IF

Could some one please give me some insight as to why this
error keeps poping up.

Thanks,
Michael

Nov 19 '05 #1
2 4719
"Michael" <mi*****@hotmai l.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.InvalidC astException: QueryInterface for interface
Scripting.IFile System3 failed.
at Scripting.FileS ystemObjectClas s.FolderExists( String
FolderSpec)
the line it fails at looks like this:

If fso.FolderExist s(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? If
you are, you should really consider using the System.IO namespace. It will
be much easier.

Jeremy

Nov 19 '05 #2
Michael
It is preferable to use the methods in File and Directory classes of
System.IO to manipulate files, rather than using scripting (ie.
FileSystemObjec t)
eg
Imports System.IO
If Directory.Exist s("...") Then
.....
End If

Stephen

"Michael" <mi*****@hotmai l.com> wrote in message
news:05******** *************** *****@phx.gbl.. .
-----Original Message-----
"Michael" <mi*****@hotmai l.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.InvalidC astException: QueryInterface for interface Scripting.IFile System3 failed.
at Scripting.FileS ystemObjectClas s.FolderExists (String FolderSpec)
the line it fails at looks like this:

If fso.FolderExist s(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? If
you are, you should really consider using the System.IO

namespace. It will
be 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 FileSystemObjec t

Michael

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
8226
by: karunakar | last post by:
Hi All Here iam getting this Error "Specified cast is not valid." My Project has Onc solution diffrent class libarary In that solution DALfactory solution iam getting this error I was calling this function in DALFactory class library(this library generate the DAL.dll) Another class library has this function public SecurityInfo Login(string username, string password) {
1
4877
by: Hifni Shahzard | last post by:
Hi, I got a stored procedure, where it returns a value. But if I execute it. It gives an error as "Invalid cast from System.Int32 to System.Byte.". To make clear how do I execute this, below I'm specifiying my code: The Code used in Visual Studio: Function GetRank(ByVal ID As Integer, ByVal Comp As String, ByVal Sec As String, ByVal iDate As Date) As String 'Dim Ret As Integer
4
2654
by: DOTNET | last post by:
Hi, Anybody help me regarding this error: I am assigning the values to the session variables when the button is clicked and passing these session variables to the next page and when I am printing these session variables they are printing. After that I am assigning these things in hidden object and in the form submit action I am receiving these hidden values like the following:
1
18168
by: Marc | last post by:
Hi! I'm working with a C# client that calls a php web service. I've created a wrapper to call the service using .NET wsdl tool (adding a web reference). The call to the server works fine, it is serialized correctly, and the server returns a response (I've captured the response and it's correct!) but when the .NET deserialize this response, it throws the exception "System.InvalidOperationException: There is an error in XML
2
13579
by: John Smith | last post by:
I'm writing webervice client using .Net 2.0. I have this class: public class MyWebService : SoapHttpClientProtocol { public XmlDocument validate(string url, XmlDocument xmlDocument) { this.Url = url;
1
5163
by: Ratz | last post by:
Hello everyone! I'm new to this Forum! I've spent about 56 hours trying to solve a .NET VB Runtime error while Using a program.Ive contacted the developer of the program and he could not figure out why i'm getting these errors! SO i have come here for the Help from the GURUS! here is one message that pops up! See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. **************...
8
4264
by: Gamma | last post by:
I'm trying to inherit subclass from System.Diagnostics.Process, but whenever I cast a "Process" object to it's subclass, I encounter an exception "System.InvalidCastException" ("Specified cast is not valid"). How do I fix it ? using System.Diagnostics; .. .. class NewProcess: Process {
4
1841
by: rsdev | last post by:
Hi, I have an InvalidCastException which is completely puzzling me. I have checked all the members in the stored procedure against my data provider and seems to be ok. Also in the stack trace it says ProcessRequestMain... +3742?? Here's the error; Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in...
2
2498
by: thithi | last post by:
Server Error in '/Assignment' Application. -------------------------------------------------------------------------------- Specified cast is not valid. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidCastException: Specified cast is not valid. Source...
0
8326
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8743
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8522
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7355
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4333
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2745
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1973
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1736
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.