C# Cannot find file
-
I am writing a small Wx app and need to access a file on the HDD to fill a combobox. I am using StreamReader and ReadLine to get it into the box. I have moved the file to the root, the file has no permissions set. Each time that I run the app it errors to the catch and tells me that it cannot find the file. I have tried File.Exists( file ) and it also tells me that it is not there. I have used @"c:\nex_tex.txt" and "c:\\nex_tex.txt" with no success. If I didn't see it with my own eyes I wouldn't believe that it was there. Anyway I am new to C# and obviously am missing something. Thanks in Advance DH
-
I am writing a small Wx app and need to access a file on the HDD to fill a combobox. I am using StreamReader and ReadLine to get it into the box. I have moved the file to the root, the file has no permissions set. Each time that I run the app it errors to the catch and tells me that it cannot find the file. I have tried File.Exists( file ) and it also tells me that it is not there. I have used @"c:\nex_tex.txt" and "c:\\nex_tex.txt" with no success. If I didn't see it with my own eyes I wouldn't believe that it was there. Anyway I am new to C# and obviously am missing something. Thanks in Advance DH
-
what do you mean with the file has no permissions set, if it has no permissions set it won't be accessible to anybody.
-
I am writing a small Wx app and need to access a file on the HDD to fill a combobox. I am using StreamReader and ReadLine to get it into the box. I have moved the file to the root, the file has no permissions set. Each time that I run the app it errors to the catch and tells me that it cannot find the file. I have tried File.Exists( file ) and it also tells me that it is not there. I have used @"c:\nex_tex.txt" and "c:\\nex_tex.txt" with no success. If I didn't see it with my own eyes I wouldn't believe that it was there. Anyway I am new to C# and obviously am missing something. Thanks in Advance DH
-
tjDieHard wrote:
the file has no permissions set
Are you sure? It really sounds like a permission problem. Click the Advanced button in the security tab of the file properties. There you can see all permissions for the file. --- b { font-weight: normal; }
-
I have checked all,and all is okay. If it was a permission would it error this way or would I get the access denied type error? I m lost
Whu dont you Right click the file and check the security tab and see if Every one is Entered And have Full Control. Just Helping if not then Have a nice day sorry to bother. -- modified at 0:31 Sunday 2nd April, 2006
-
I am writing a small Wx app and need to access a file on the HDD to fill a combobox. I am using StreamReader and ReadLine to get it into the box. I have moved the file to the root, the file has no permissions set. Each time that I run the app it errors to the catch and tells me that it cannot find the file. I have tried File.Exists( file ) and it also tells me that it is not there. I have used @"c:\nex_tex.txt" and "c:\\nex_tex.txt" with no success. If I didn't see it with my own eyes I wouldn't believe that it was there. Anyway I am new to C# and obviously am missing something. Thanks in Advance DH
Hi! Could it be that your Windows Explorer is hiding the extensions of known filetypes so that you're seeing "nex_tex.txt" as filename but the true filename is "nex_tex.txt.txt"? Regards, mav -- Black holes are the places where god divided by 0...
-
I have checked all,and all is okay. If it was a permission would it error this way or would I get the access denied type error? I m lost
If you don't have permission to access a file, the error message you get is that it doesn't exist. This is commonly found when someone tries to make a web application access a file in a user folder, like for an example the desktop. As the web application is not run under the user's account it can not access files in a user folder. I still think that it might be a permission problem, especially if you moved the file from some other folder. Then it might still have permission settings from the previous place. Create a new folder somewhere that you know the application has access, put the file in the folder, and in the advanced security properties of the folder choose to replace all security settings of child objects. That will remove any specific settings on the file. Now try to access the file. --- b { font-weight: normal; }
-
Hi! Could it be that your Windows Explorer is hiding the extensions of known filetypes so that you're seeing "nex_tex.txt" as filename but the true filename is "nex_tex.txt.txt"? Regards, mav -- Black holes are the places where god divided by 0...