Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Config File: Read Only

Config File: Read Only

Scheduled Pinned Locked Moved Visual Basic
question
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Brad Fackrell
    wrote on last edited by
    #1

    I have multiple *.config files that I need to write to but (somehow) they have all been set to ‘read only’. Can anybody tell me how, in my code, I can uncheck the read only option before attempting to write to the file? Thanks Brad

    B D 2 Replies Last reply
    0
    • B Brad Fackrell

      I have multiple *.config files that I need to write to but (somehow) they have all been set to ‘read only’. Can anybody tell me how, in my code, I can uncheck the read only option before attempting to write to the file? Thanks Brad

      B Offline
      B Offline
      Brad Fackrell
      wrote on last edited by
      #2

      Brad Fackrell wrote: uncheck the read only option before attempting to write to the file? System.IO.File.SetAttributes("c:\test.txt", IO.FileAttributes.Normal)

      1 Reply Last reply
      0
      • B Brad Fackrell

        I have multiple *.config files that I need to write to but (somehow) they have all been set to ‘read only’. Can anybody tell me how, in my code, I can uncheck the read only option before attempting to write to the file? Thanks Brad

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        You're looking for the FileInfo[^] class and it's GetAttributes and Set Attributes methods. It's nice that you put this functionality into the app, but there are also cases when the suer WANTS the config files read only. It would be better if you added an option to turn this functionality on/off. It would also be better if you figured out why your development copy is ReadOnly in the first place. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        B 1 Reply Last reply
        0
        • D Dave Kreskowiak

          You're looking for the FileInfo[^] class and it's GetAttributes and Set Attributes methods. It's nice that you put this functionality into the app, but there are also cases when the suer WANTS the config files read only. It would be better if you added an option to turn this functionality on/off. It would also be better if you figured out why your development copy is ReadOnly in the first place. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          B Offline
          B Offline
          Brad Fackrell
          wrote on last edited by
          #4

          Thanks Dave. I like the idea of being able to turn it on and off. As for why it was read only, I have no idea what happened but I do know that is should NOT be read only and everybody was yelling at me to ‘just do something’. So, for now, I will just force it back to normal. Brad

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups