By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,918 Members | 1,557 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,918 IT Pros & Developers. It's quick & easy.

File Access Denied!

P: n/a
Hi ,
Platform VB.Net
I have a form with a listview(filled with all the ".bmp" files on "c:\") and
a picture box.
The picturebox displays the image files which are in selected mode on the
listview .
My problem is, i get the "security_exception" error,when i try to delete the
selected files in the listview.
I use the "filesystemobject" to delete the file(s).
I try to dispose the images displayed by the picturebox but still the same
error is thrown.
I'm sure that all of the image files are in "normal mode", not "readonly".

Any suggestions!
Thanks.
Tarkan

Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi tarkan,
To delete files, use the following:

IO.File.Delete(fname)

Where fname is the full path of the file to delete, for instance
"c:\test\file.bmp".
If you still get Access Denied, then it's because of system level security
permissions!
Try to delete the same file with Windows Explorer. If you cant with Windows
Explorer, that's because you are not logged as administrator or have no
rights to do it.
That is obvious! If an user runs your application on a Windows XP limited
account the application privileges are the same as user's. That means he
will not be able to delete some folders and files. That is normal and "by
design". What your application should do is to catch the exceptions and
handle it in an user-friendly way (message box, button disable, or
whatever).

Regards,
Mario
"tarkan" <mt*****@msn.com'@nospam> wrote in message
news:eM**************@TK2MSFTNGP09.phx.gbl...
Hi ,
Platform VB.Net
I have a form with a listview(filled with all the ".bmp" files on "c:\") and a picture box.
The picturebox displays the image files which are in selected mode on the
listview .
My problem is, i get the "security_exception" error,when i try to delete the selected files in the listview.
I use the "filesystemobject" to delete the file(s).
I try to dispose the images displayed by the picturebox but still the same
error is thrown.
I'm sure that all of the image files are in "normal mode", not "readonly".

Any suggestions!
Thanks.
Tarkan

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.