Results 1 to 10 of 10

Thread: Deleting/Killing a file... help!

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2003
    Posts
    5

    Deleting/Killing a file... help!

    Hello, this is my first post here on the VBForums. Since I just got VB 6.0 and I learned how to use it last year it's a lot of fun just playing around with it. Yesterday I d/l an MP3 player and modified it a little bit. But I have 1 problem, when I try to delete a file that is in my list, I can't because I get an error. I haven't learned how to delete files yet so if anyone can clue me in, that would help out a lot.

    Private Sub Command3_Click()
    Kill File1.path & "\" & File1.FileName << Says there's an error in this line
    File1.Refresh
    End Sub


    Any help is greatly appreciated, thanks!

  2. #2
    Frenzied Member TomGibbons's Avatar
    Join Date
    Feb 2002
    Location
    San Diego, CA Previous Location: UK
    Posts
    1,345
    What does the error message say?

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2003
    Posts
    5
    Run-time error '53':

    File not found



    The purpose of the delete button is to delete a file that I added from my hard drive into my playlist... So I click on the file and then click delete and that's the error message that I get.

  4. #4
    Frenzied Member TomGibbons's Avatar
    Join Date
    Feb 2002
    Location
    San Diego, CA Previous Location: UK
    Posts
    1,345
    Are you making sure the file is actually there, you dont have the path incorrect or somthing

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2003
    Posts
    5
    Yeah I'm sure it's there........ I select it and it becomes highlighted and then click delete and i get that error.

  6. #6
    Lively Member
    Join Date
    Aug 2002
    Posts
    90
    does file1.path already have a '\' at the end of it?

  7. #7

    Thread Starter
    New Member
    Join Date
    Mar 2003
    Posts
    5
    No, it does not...

  8. #8
    Lively Member
    Join Date
    Aug 2002
    Posts
    90
    try this for debugging:


    Private Sub Command3_Click()
    a=File1.path & "\" & File1.FileName
    msgbox a
    Kill a
    File1.Refresh
    End Sub

  9. #9

    Thread Starter
    New Member
    Join Date
    Mar 2003
    Posts
    5
    Doesn't work... Can you please e-mail me at [email protected] so I can send you the program and you can see what's wrong? That would be so great of you... Thanks.

  10. #10
    Fanatic Member Illspirit's Avatar
    Join Date
    Mar 2001
    Location
    Blackpool, England
    Posts
    815
    VB Code:
    1. Dim sFile As String
    2. sFile = Replace(File1.Path & "\" & File1.FileName, "\\", "\")
    3.  
    4. If Dir(sPath) = vbNullString Then
    5.     MsgBox "The following file does not exist:" & vbCrLf & sFile, vbExclamation
    6. Else
    7.     Kill sFile
    8. End If
    Illspirit - [email protected]

    SmartBarXP Lead Developer
    SmartBarXP - The leading desktop sidebar application for Microsoft Windows XP

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