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?
laveshvermaAsked:
Who is Participating?
 
LeithauserConnect With a Mentor Commented:
Regarding

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"
0
 
GrahamSkanRetiredCommented:
See if another VB method such as Dir$() can find it.

If Dir$("D:\tpf\av.bmp") = "" then
     Msgbox "File not found"
Else
      Kill "D:\tpf\av.bmp"
      MsgBox "File deleted"
end if
0
 
BardobraveCommented:
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
0
 
laveshvermaAuthor Commented:
Thank you Sir, Now the command working completely well...:)
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.