Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to delete a file in VB6 without using filesystem obj
Message
From
26/07/2000 03:32:52
 
 
To
26/07/2000 02:34:22
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00396924
Message ID:
00396934
Views:
8
>Hi! I need some help. A friend of mine is developing an application in VB6 that creates a text file with some info in it extracted from a database. The problem is that there are times when the database is empty and the system is left with a text file that contains nothing in it. How do we delete this file? We're thinking of issuing a command similar to the dos Delete command, e.g. (run at dos prompt) c:\del mytext.txt
>
>Any ideas how to do this? Someone suggested using shell command but we don't know how. Would greatly appreciate any sample code. Thanks!
>

If no other mechanism is available, then the DeleteFile API call will do this:

Public Declare Function DeleteFile Lib "kernel32" Alias "DeleteFileA" (ByVal lpFileName As String) As Long

DeleteFileA as declared above returns 0 for failure and any other value for success.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform