Results 1 to 5 of 5

Thread: How to change folder attribute?

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2001
    Location
    Linkoping, Sweden
    Posts
    50

    How to change folder attribute?

    I would like to change folder attribute from Read Only!

    Anyone that knows how to do that in VB.net, please?

  2. #2

    Thread Starter
    Member
    Join Date
    Nov 2001
    Location
    Linkoping, Sweden
    Posts
    50

    step 2

    What I really want to do is to delete folder but I guess I have to change the ReadOnly attribute first.

  3. #3
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Hi.

    The DirectoryInfo class has an attributes property that you can manipulate.

    To remove the ReadOnly attribute use this:
    VB Code:
    1. Dim d As New IO.DirectoryInfo(MyFolder)
    2.         d.Attributes = d.Attributes And Not FileAttributes.ReadOnly
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

  4. #4

    Thread Starter
    Member
    Join Date
    Nov 2001
    Location
    Linkoping, Sweden
    Posts
    50

    thanks

    But when I copied your code, my system complains that:

    FileAttributes.ReadOnly is not declared.

    Any ideas?

  5. #5

    Thread Starter
    Member
    Join Date
    Nov 2001
    Location
    Linkoping, Sweden
    Posts
    50

    sorry

    Imports System.IO solved that problem....

    /Anders

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