[HELP]When File already exists, how do we by pass that error.
When a file already exists at the location, how do we bypass that error and overrite that file?
Elaborate?
for starting a program after you click a button use
Code:
Shell("cmd.exe /c [program path and name (i.e. C:\Program Files\run.exe)]")
for moving and copying files you have to look up the cmd commands for that. Sorry if the code above has a few errors in it. I havent done VB in a long time!
Delete the Initial File first....
[php]
Dim FileToDelete as New FileInfo("FilePath\FileName.Extension")
FileToDelete.Delete()
[/php]
Then
[php]
If System.IO.File.Exists("Filepath/FileToMove.Extension) = True Then
System.IO.File.Move("Filepath/FileToMove.Extension", "Path To Move File")
End If
[/php]
If you want to go a-little further you can use P/Invoke and Force Delete the File first...But in either case, delete the file then move to path...
By the way, that is exactly how windows works with overwriting, it just moves quick, when you get the dialog box or message box that says "would you like to overwrite?" what it is actually saying is, would you like to delete the original file and replace it with this one. So manually delete file then move
Nextgen you have wayyyy to much time on your hands. haha.
Originally Posted by SSK.Darken
Nextgen you have wayyyy to much time on your hands. haha.
Lol how is that having way to much time on his hands. It was a good and comprehensive answer but it's not like it was pages and pages of explanation. Knowing NextGen, I'd take a stab at <5 mins to write that post.
What Nextgen told you, is kinda logical if you actually think about it. So, good solution :]
I have 0 time on my hands :P and I still make time to do my "job"
Originally Posted by NextGen1
I have 0 time on my hands :P and I still make time to do my "job"
And we appreciate it.
Originally Posted by SSK.Darken
Nextgen you have wayyyy to much time on your hands. haha.
>.<
Heck, i don't think he'd spend that long.
Maybe. what... less than a few minutes?
But good job NextGen !