code to delete *.tmp file in vb6

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2008
Posts: 2
Reputation: shruti23 is an unknown quantity at this point 
Solved Threads: 0
shruti23 shruti23 is offline Offline
Newbie Poster

code to delete *.tmp file in vb6

 
0
  #1
Oct 26th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,125
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 129
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Postaholic

Re: code to delete *.tmp file in vb6

 
0
  #2
Oct 26th, 2008
You can delete those files by using the DOS command.

DEL *.TMP

That can be executed from VB.
Share your Knowledge.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 20
Reputation: rstkw is an unknown quantity at this point 
Solved Threads: 2
rstkw rstkw is offline Offline
Newbie Poster

Re: code to delete *.tmp file in vb6

 
0
  #3
Oct 26th, 2008
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"
Last edited by rstkw; Oct 26th, 2008 at 12:43 pm. Reason: Better explanation
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 2
Reputation: shruti23 is an unknown quantity at this point 
Solved Threads: 0
shruti23 shruti23 is offline Offline
Newbie Poster

Re: code to delete *.tmp file in vb6

 
0
  #4
Nov 5th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: code to delete *.tmp file in vb6

 
0
  #5
Nov 5th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 9
Reputation: vponline is an unknown quantity at this point 
Solved Threads: 0
vponline vponline is offline Offline
Newbie Poster

Re: code to delete *.tmp file in vb6

 
0
  #6
Nov 5th, 2008
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
Last edited by Narue; Nov 13th, 2008 at 9:35 pm. Reason: snipped fake signature
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC