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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. is there any function in vb where you can retrieve if a specific removable drive or disk is write protected = true or false?? [modified]

is there any function in vb where you can retrieve if a specific removable drive or disk is write protected = true or false?? [modified]

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.
  • V Offline
    V Offline
    vbDiggerz
    wrote on last edited by
    #1

    is there any function in vb where you can retrieve if a specific removable drive or disk is write protected = true or false?? or any other way custom function you can retrieve its write protection state??? please...

    modified on Thursday, July 24, 2008 4:30 AM

    L 1 Reply Last reply
    0
    • V vbDiggerz

      is there any function in vb where you can retrieve if a specific removable drive or disk is write protected = true or false?? or any other way custom function you can retrieve its write protection state??? please...

      modified on Thursday, July 24, 2008 4:30 AM

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Maybe try writing a temporary file to the drive, if it writes it's not write-protected, if it throws an 'Access Denied' error it may be write-protected (or you don't have adequate permissions)?

      V 1 Reply Last reply
      0
      • L Lost User

        Maybe try writing a temporary file to the drive, if it writes it's not write-protected, if it throws an 'Access Denied' error it may be write-protected (or you don't have adequate permissions)?

        V Offline
        V Offline
        vbDiggerz
        wrote on last edited by
        #3

        Yup!! that's also what im thinking before.. create a temp. file if it returns permission/write protected error means false and if transaction success means true... i just got an error handling before but i've figure it out... hehe HERE'S my sample function: '***********start fucntion**** Private Function IsDriveWriteProtected(Byval DriveName as String) as boolean try 'System.io.File.Create() statement goes here.. return false catch ex as exception 'if error arise? means write protected or permission to write access denied return true end try End Function '************end fucntion******* ***********Thanks to "THE JZ" ******** youre a quite good help.. and i'll mark this thread as answered in your name.. thanks again... :)

        L 1 Reply Last reply
        0
        • V vbDiggerz

          Yup!! that's also what im thinking before.. create a temp. file if it returns permission/write protected error means false and if transaction success means true... i just got an error handling before but i've figure it out... hehe HERE'S my sample function: '***********start fucntion**** Private Function IsDriveWriteProtected(Byval DriveName as String) as boolean try 'System.io.File.Create() statement goes here.. return false catch ex as exception 'if error arise? means write protected or permission to write access denied return true end try End Function '************end fucntion******* ***********Thanks to "THE JZ" ******** youre a quite good help.. and i'll mark this thread as answered in your name.. thanks again... :)

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          You're welcome. Glad I could help.

          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