CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Delete a File

  1. #1
    Join Date
    Oct 2000
    Location
    MN
    Posts
    8

    Delete a File

    Hello,
    Anybody know how to delete a 'Read Only File' using VB. I tried Kill and it failed. Solution I have is to use shell("delete /F <Filename>").
    Any other suggestions??



  2. #2
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Re: Delete a File

    Try turning off the ReadOnly attribute bit first then "Kill"ing it

    private Sub Command1_Click()
    Dim MyFile
    MyFile = "C:\Vb stuff/things to look at\Daily.ctl"
    SetAttr MyFile, GetAttr(MyFile) And (255 - vbReadOnly)
    End Sub




    should clear its attributes

    John G

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

Featured