Deleting a image using Vb6.0

Hello Sir,
I want to delete the images, which are in .bmp format using Visual Basic 6.0.
how is it be done??
I have used the command like:
1.  Kill App.Path & "av.bmp"
2.  Kill "D:\tpf\av.bmp"
But both of these are not working and the error is showing like " File not found".While I have a picture on the path "D:\tpf \" with name "av.bmp"
Please Guide me how to solve this problem?
Who is Participating?
LeithauserConnect With a Mentor Commented:

Kill App.Path & "av.bmp"

You should note that App.Path does not include a trailing \. That means that Kill App.Path & "av.bmp"
will return something like D:\tpfav.bmp if D:\tpf is the App Path. You need to use

Kill App.Path & "\av.bmp"
See if another VB method such as Dir$() can find it.

If Dir$("D:\tpf\av.bmp") = "" then
     Msgbox "File not found"
      Kill "D:\tpf\av.bmp"
      MsgBox "File deleted"
end if
If you're getting a "File not found" error it must be something to do with path issues. Maybe you have some misspelling in your path or file description, or maybe your D unit is mapped into your computer in a way that application cannot resolve.

If D: is pointing to a remote unit you must use the network address \\domainServer\pathToFile\file
laveshvermaAuthor Commented:
Thank you Sir, Now the command working completely well...:)
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.