VB6.0 When i am clicking at button to delete a file c:\example.exe

Hello Experts!! newbie here ...
 
I am using VB6.0 and i want  When i am clicking at button to delete a file c:\example.exe ... so simple i think please
paste me the source..
KingSencatAsked:
Who is Participating?
 
Mark_FreeSoftwareCommented:
add a button

then paste this code:


Private Sub Command1_Click()
Kill "c:\example.exe"
End Sub


0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Private Sub Command1_Click()
    Kill "c:\example.exe"
End Sub
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
It would be a good idea to put some error trapping in there just in case...

Private Sub Command1_Click()
    On Error GoTo failure
    Kill "c:\example.exe"
    Exit Sub
   
failure:
    MsgBox Err.Description, vbCritical, "Delete Failed"
End Sub
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Mark_FreeSoftwareCommented:

heh beat you to it in less than a minute :P

i think that is the first time ;)
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
=(

Quit being mean to me...I think I'll quit EE now!






Just kidding...  =)
0
 
Mark_FreeSoftwareCommented:

it is not fair, you do have an unfair advantage on (over?) me

you learned basic before i was even born >.<
0
 
KingSencatAuthor Commented:
Please help in the other 2 of my questions
0
 
KingSencatAuthor Commented:
I cant delete the file because its already running at TASK MANAGER ... how can i end the process ( not manually )
0
 
Mark_FreeSoftwareCommented:
let me guess, explorer.exe?
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Are you trying to make an EXE delete itself?
0
 
KingSencatAuthor Commented:
No is not explorer.exe ....
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.