473,397 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

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 4062
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jobs | last post by:
Hello All, I want to delete all files in a directory. I am making a backup copy of all files in the directories say c:\abc by reading and writing to a file. After making a backup copy I want to...
0
by: SeanR | last post by:
I have a function to copare two files. It will first copy the original file form a different server to a local temp path and then compare that version to a version that has been restored form tape....
5
by: | last post by:
Hi all, I've been using C++ for quite a while now and I've come to the point where I need to overload new and delete inorder to track memory and probably some profiling stuff too. I know that...
23
by: da Vinci | last post by:
Greetings, Onwards with the school studying. Working on a program and need to delete a file from a known location on the hard drive but cannot get anything I do to work. I have tried to use...
12
by: Lucas Tam | last post by:
I have a very simple loop: If (Directory.Exists(tempDirectory)) Then Try Dim Files() As String = Directory.GetFiles(tempDirectory) 'Clear out directory For Each Filename As String In Files...
9
by: Paul | last post by:
I'm trying to make get my app to delete all the files in a specified folder and all the files within the folders of the specified folder. e.g. Folder 1 contains three files (File1, File2, File3)...
2
by: createdbyx | last post by:
I am trying to make a file sync utillity to sync files between my laptop and my desktop pc. On my desktop machine (xp pro sp2) I have shared my "Visual Studio Projects" folder using windows simple...
5
by: wo20051223 | last post by:
Deleting some files with C# fails with "Access to the path 'X' is denied". I have files copied from a CD that I burned (and not locked by a process) and a text file that I created in Windows...
3
by: Arpan | last post by:
A Form has a FileUpload, 2 Buttons & a TextBox web server controls. Using the FileUpload control, I want to give users the provision to move & delete files that DO NOT exist in C:\Inetpub\wwwroot...
7
by: Anil Gupte | last post by:
Private Sub mnu2Exit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu2Exit.Click Dim fDir As String = Path.GetDirectoryName(L3Global.VideoFileName) ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
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,...

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.