Results 1 to 4 of 4

Thread: [RESOLVED]VB6, Kill() give error

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2006
    Posts
    23

    Resolved [RESOLVED]VB6, Kill() give error

    Hello,

    When I run a script with:
    VB Code:
    1. Kill "C:\test\test.txt"

    I get a error "file not found"

    But the file does exist and actually the script does delete the file but it always give that error.
    Is this a wrong use of the function or...

    Thanks
    Last edited by Martijnc; Apr 8th, 2006 at 02:07 PM.

  2. #2
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: VB6, Kill() give error

    Hi,

    Check the existence of the file then delete it:
    VB Code:
    1. If Dir$("C:\test\test.txt") <> "" Then Kill "C:\test\test.txt"

    The above statement deleted the file (if exist) without any error; at the same time it will not tell/throw you any error if the file doesn't exist.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2006
    Posts
    23

    Re: VB6, Kill() give error

    Thanks, that works, the file is deleted and no errors anymore

  4. #4
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: [RESLOVED] VB6, Kill() give error

    You are welcome!

    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.

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