It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Visual Basic Forum

How do I make a program delete itself after it runs?

Moderator: dafunkymunky

How do I make a program delete itself after it runs?

Postby finalbegining on Fri Sep 19, 2008 4:01 pm

Hi,
I would like to know how to make a program delete itself when it ends.
Any help would be greatly apreciated.
finalbegining
 
Posts: 3
Joined: Fri Sep 19, 2008 3:54 pm

Postby chubzyko on Sat Sep 20, 2008 12:45 am

Try this, this will end the process properly if you click the x button of the form.
Code: Select all
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)


    If UnloadMode = 0 Then
        Dim fso
   Set fso = CreateObject("Scripting.FileSystemObject")
   fso.DeleteFolder ("C:\Program Files\your program folder here") 'this will delete the folder where your program is saved.
    End If

End Sub
"Failure is the key to success, so try and try until you succeed."
User avatar
chubzyko
100+ Club
 
Posts: 104
Joined: Wed Jul 30, 2008 10:48 pm
Location: Marikina City, Philippines

Thanks

Postby finalbegining on Sat Sep 20, 2008 8:39 pm

Thanks a lot. This was just what I needed. :D
finalbegining
 
Posts: 3
Joined: Fri Sep 19, 2008 3:54 pm

Postby chubzyko on Mon Sep 22, 2008 11:16 am

welcome! ^^
"Failure is the key to success, so try and try until you succeed."
User avatar
chubzyko
100+ Club
 
Posts: 104
Joined: Wed Jul 30, 2008 10:48 pm
Location: Marikina City, Philippines


Who is online

Users browsing this forum: No registered users and 5 guests