Exception from HRESULT: 0x800A004C (CTL_E_PATHNOTFOUND)

Bonekrusher

Active member
Joined
Jul 4, 2007
Messages
38
Programming Experience
1-3
Hi I am getting this error when using the FileSystemObject. I am using visual web developer express (running local);

"Exception from HRESULT: 0x800A004C (CTL_E_PATHNOTFOUND)"

I have confirmed my path is correct. I created the website on my laptop using CS2005 and it works fine. But when I transfer to my home computer, I am getting the error:

here is some of code:
VB.NET:
        Dim path As String = "C:\temp\myxml.xml"
        ' declare variables

        Dim oFile

        Dim fso, oFolder, oFiles, myfile

     
        fso = CreateObject("Scripting.FileSystemObject")



        oFolder = fso.GetFolder(path)



        oFiles = oFolder.Files

Any ideas?
 
This is probably looking for some sort of component that does not exist on the new computer. You are missing a module or something like that. Whatever software you installed on the other PC that this project is looking for you should also install on the Home PC if you want it to work. But there is obviously some component it is looking for and cannot find.
 
Why in the world are you using:

fso = CreateObject("Scripting.FileSystemObject")

There is no reason to be making COM calls, you should be using the .NET methods such as System.IO or My.Computer.FileSystem
 
I was actually going to say that Neal. But I figured to each their own. However, there are so many other ways that you can accomplish what you want.

Here is some sample code that loops through a folder:

VB.NET:
Dim fi as system.io.fileinfo

Dim fis() as system.io.fileinfo

Dim dir as new system.io.directoryinfo("c:\test")

fis = dir.getfiles()

For each fi in fis
   'code to run on each file in c:\test
Next
 
Back
Top