468,306 Members | 1,174 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,306 developers. It's quick & easy.

Delete file

Hello,

I am making a program that will not have an user interaction to delete
certian files. I found this line of code.
My.Computer.FileSystem.DeleteFile("C:\POLLJP.DWN",
FileIO.UIOption.AllDialogs, FileIO.RecycleOption.DeletePermanently)
The problem is that a message box comes up and asks "Are you sure you
want to delete file"file name yes or no". Does anyone know a way
around this. I want it to delete everytime no questions asked .Thank
you
Jun 27 '08 #1
4 3674
On Jun 10, 11:03*pm, id10t error <tubbz...@gmail.comwrote:
Hello,

I am making a program that will not have an user interaction to delete
certian files. I found this line of code.
My.Computer.FileSystem.DeleteFile("C:\POLLJP.DWN",
FileIO.UIOption.AllDialogs, FileIO.RecycleOption.DeletePermanently)
The problem is that a message box comes up and asks "Are you sure you
want to delete file"file name yes or no". Does anyone know a way
around this. I want it to delete everytime no questions asked .Thank
you
That's because you're passing FileIO.UIOption enum as "AllDialogs"
then simply change your code to:

My.Computer.FileSystem.DeleteFile("C:\POLLJP.DWN",
FileIO.UIOption.OnlyErrorDialogs,
FileIO.RecycleOption.DeletePermanently)

Thanks,

Onur Güzel

Jun 27 '08 #2
On Jun 10, 4:03*pm, id10t error <tubbz...@gmail.comwrote:
Hello,

I am making a program that will not have an user interaction to delete
certian files. I found this line of code.
My.Computer.FileSystem.DeleteFile("C:\POLLJP.DWN",
FileIO.UIOption.AllDialogs, FileIO.RecycleOption.DeletePermanently)
The problem is that a message box comes up and asks "Are you sure you
want to delete file"file name yes or no". Does anyone know a way
around this. I want it to delete everytime no questions asked .Thank
you
The File.Delete method does not present the user with a nag box. But I
am not sure if it can permanently delete the file.

I think the File class is in the System.IO namespace.
Jun 27 '08 #3
Or you could use the good old "Kill" command.
Kill "C:\POLLJP.DWN" will permanently delete that file.

On 11.06.2008 04:42, schrieb za***@construction-imaging.com:
On Jun 10, 4:03 pm, id10t error<tubbz...@gmail.com wrote:
>Hello,

I am making a program that will not have an user interaction to delete
certian files. I found this line of code.
My.Computer.FileSystem.DeleteFile("C:\POLLJP.DWN" ,
FileIO.UIOption.AllDialogs, FileIO.RecycleOption.DeletePermanently)
The problem is that a message box comes up and asks "Are you sure you
want to delete file"file name yes or no". Does anyone know a way
around this. I want it to delete everytime no questions asked .Thank
you

The File.Delete method does not present the user with a nag box. But I
am not sure if it can permanently delete the file.

I think the File class is in the System.IO namespace.
Jun 27 '08 #4
On Jun 10, 11:42*pm, za...@construction-imaging.com wrote:
On Jun 10, 4:03*pm, id10t error <tubbz...@gmail.comwrote:
Hello,
I am making a program that will not have an user interaction to delete
certian files. I found this line of code.
My.Computer.FileSystem.DeleteFile("C:\POLLJP.DWN",
FileIO.UIOption.AllDialogs, FileIO.RecycleOption.DeletePermanently)
The problem is that a message box comes up and asks "Are you sure you
want to delete file"file name yes or no". Does anyone know a way
around this. I want it to delete everytime no questions asked .Thank
you

The File.Delete method does not present the user with a nag box. But I
am not sure if it can permanently delete the file.

I think the File class is in the System.IO namespace.
As OP requests, with "DeleteFile" method in My namespace, a file can
be deleted permanently without any user interaction of confirmation,
except errors(see 2nd and 3rd parameters):

My.Computer.FileSystem.DeleteFile("C:\POLLJP.DWN",
FileIO.UIOption.OnlyErrorDialogs,
FileIO.RecycleOption.DeletePermanently)

unless you try to recover with a recovery software of course :)

Thanks,

Onur Güzel
Jun 27 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Jobs | last post: by
5 posts views Thread by | last post: by
23 posts views Thread by da Vinci | last post: by
5 posts views Thread by wo20051223 | last post: by
3 posts views Thread by Arpan | last post: by
7 posts views Thread by Anil Gupte | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.