Results 1 to 7 of 7

Thread: Can someone tell me what I have wrong?

  1. #1

    Thread Starter
    Hyperactive Member Sacofjoea's Avatar
    Join Date
    May 2000
    Location
    Never Never Land
    Posts
    472
    Private Sub Command1_Click()
    MsgBox "Are you sure you wish to delete the files?"
    Kill "C:\windows\desktop\test\*.*"
    End Sub

    ok... I had the exact same problem in QBasic... it wouldn't delete all the files in the directory...it says "File not found" Can I not use this command with multiple files?

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    No you have to retrieve all the files with Dir and then delete each file
    Code:
     Dim a$
     a=dir(path)
      do while len(a)
       kill path & "\" & a
       a=dir
      loop
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    You also want to make sure you process the answer to your "Are you sure you wish to delete..." question.

    Private Sub Command1_Click()
    Dim intResponse as Integer

    intResponse = MsgBox("Are you sure you wish to delete the files?", vbYesNo)

    If inResponse = vbYes then
    ' kill the files
    End If
    End Sub

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Of course! I forgot that Martin.
    if MsgBox("Are you sure you wish to delete the files?", vbYesNo) = vbYes then
    if MsgBox("Are you really sure?", vbYesNo) = vbYes then
    if MsgBox("Hey! Those file are very important, do you actually want to delete them?", vbYesNo) = vbYes then
    if MsgBox("Don't press yes, will you?", vbYesNo) = vbYes then
    if MsgBox("Press no, or i'll kill you too", vbYesNo) = vbYes then
    'Kill the files
    end if
    end if
    end if
    end if
    end if
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5
    Guest
    I find the DIR() very messy, I use the FileSystemObject, which lets you use For...Each...Next to manipulate files in a folder.

  6. #6
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    The advantage of using Dir function is that you don't have to ditribute extra DLL for filesystem object.

  7. #7
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Yup, all the function in filesystemobject can you do with vb, and they will run faster that way. There's probably only one thing you can't do with files, and that's cropping them while open in binary
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width