| | |
code to delete *.tmp file in vb6
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2008
Posts: 20
Reputation:
Solved Threads: 2
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"
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
•
•
Join Date: Jul 2008
Posts: 9
Reputation:
Solved Threads: 0
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
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
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Pass a text file through a batch file
- Next Thread: Combine multiple file parts into a new one
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






