By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,745 Members | 1,897 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,745 IT Pros & Developers. It's quick & easy.

deleting files

vdraceil
100+
P: 236
Is it possible to delete files(any file) in the system from within vb??I ask this because it is possible to create a text file and save it from within vb..there must be a way to delete the created files i suppose,but i dont know how!
Sep 11 '07 #1
Share this Question
Share on Google+
2 Replies


kadghar
Expert 100+
P: 1,295
Is it possible to delete files(any file) in the system from within vb??I ask this because it is possible to create a text file and save it from within vb..there must be a way to delete the created files i suppose,but i dont know how!
Sure, create a File System Object, and delete the file, something like this should do:

Expand|Select|Wrap|Line Numbers
  1. dim obj1 as object
  2. set obj1 = createobject("scripting.filesystemobject")
  3. obj1.deletefile "c:\file.txt", true
HTH
Sep 11 '07 #2

VBPhilly
P: 95
Is it possible to delete files(any file) in the system from within vb??I ask this because it is possible to create a text file and save it from within vb..there must be a way to delete the created files i suppose,but i dont know how!
or, if you dont want to create a filesystemobject, use the Kill statement:

Expand|Select|Wrap|Line Numbers
  1. Kill "C:\DeadFile.txt" 
  2.  
Sep 11 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.