hi Sirs,
i m using vb6 and acess2000, crystal report 9.
i want to delete *.tmp files created due to crystal report 9.
i want this in vb6 through coding.
pls help me.
these files are created on partition and of 0 bytes.
so, pls help me its urgent.
thanx in advance

You can delete those files by using the DOS command.

DEL *.TMP

That can be executed from VB.

This is from VBHelp. If you use an error handler, I would suggest that you disable it, as in the example, because Kill can generate non-fatal errors. For instance, the file the example tries to delete doesn't exist.

Public Sub ErrDemoSub()
On Error GoTo SubHandler ' Error trapping is
' enabled.
' Errors need to be caught and corrected here.
' The Kill function is used to delete a file.
Kill "Oldfile.xyz"
On Error GoTo 0 ' Error trapping is turned off
' here.
Kill "Oldfile.xyz"
On Error GoTo SubHandler ' Error trapping is
' enabled again.
Kill "Oldfile.xyz"
Exit Sub
SubHandler: ' Error-handling routine goes here.
MsgBox "Caught error."
Resume Next
End Sub

If you aren't worried about error messages, just use:
Kill "C:\[path]\*.tmp"

Dear Sir,
Thanks for reply.
pls tell me how do i write code in vb to delete these *.tmp files?
pls give me code snippet.
so that i will solve it immediately.
thnaks for reply once again
shruti

Hi Shruti,

rstkw has already answered you:

Write this Code:

Kill "C:\MyFolder\*.tmp"

Change MyFolder, to whatever folder you want.. Anyway, whenever, you Kill files, you need to be carefull..

Regards
Veena

Exactly was i was going to say to use
Kill "C:\[path]\*.tmp"
if its only a temp file,it should be used,i use the same thing in my software when i wrote "preview" code for some software i released
matt's java flexbars (scrollbar coder for IE5 and up) created in vb and produces java script to be added to your website that fluctuates the scrollbars colors

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.