Results 1 to 8 of 8

Thread: Can't access a mapped drive

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2012
    Posts
    75

    Can't access a mapped drive

    I have mapped a directory on a home networked computer to drive Z:. At a command prompt, I can switch to drive Z: and perform a directory listing. In File Explorer the directory shows under "Network locations" as "d (\\192.168.0.103) (Z:)", where d is the mapped directory and the number within parentheses is the computer's IP address.

    However in a Visual Basic program, the statement

    Dim Drives() As DriveInfo = DriveInfo.GetDrives

    does *not* return drive Z: as one of the drives and a statement referring to a file in Z: returns a Directory Not Found exception.

    How can I access a networked drive from within Visual Basic?
    Last edited by coffent; Apr 22nd, 2020 at 01:24 PM. Reason: Remove auto-generated emoticon

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Can't access a mapped drive

    Quote Originally Posted by coffent View Post
    * There should not be a space after Z:. However if I leave it out it gets turned into a smiley face. How can I prevent emoticon substitutions?
    When posting a reply (or editing an existing one) click on "Go Advanced" (for creating a new thread, I think you don't need this stage).

    Under the text area is an area titled "Additional Options". Under that is a tick-box for "Disable smilies in text".

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2012
    Posts
    75

    Re: Can't access a mapped drive

    Thanks - one problem solved. Now for the other one

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Feb 2012
    Posts
    75

    Re: Can't access a mapped drive

    I finally solved the problem by running Visual Studio as Administrator. I don't know why this is necessary, and if anyone has an explanation I'd be glad to see it!
    Last edited by coffent; Apr 22nd, 2020 at 02:22 PM.

  5. #5
    Lively Member
    Join Date
    Jan 2020
    Posts
    119

    Re: Can't access a mapped drive

    Hello,@ coffent

    Follow this step,To Can't access a mapped drive

    Step 1 :- Open Computer by clicking the Start button and then clicking Computer.
    Step 2 :- Click Map Network Drive.
    Step 3 :- In the Drive list, click any available drive letter.
    Step 4 :- In the Folder box, type the path of the folder or computer, or click Browse to find the folder or computer.then Click Finish.

    I hope this information will be usefull for you.
    Thank You.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Feb 2012
    Posts
    75

    Re: Can't access a mapped drive

    Thanks for your reply. As I said, I think I've solved the problem by simply running VB as an Administrator. Why that should be necessary I don't know (but there are many things about Windows I don't understand).

  7. #7
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,958

    Re: Can't access a mapped drive

    Quote Originally Posted by coffent View Post
    Thanks for your reply. As I said, I think I've solved the problem by simply running VB as an Administrator. Why that should be necessary I don't know (but there are many things about Windows I don't understand).
    Did you map the drive letter as administrator? If so the mapping only exists for the administrator account, if you are running the app as your own user then map the drive as yourself.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Feb 2012
    Posts
    75

    Re: Can't access a mapped drive

    It appears I must have, even though I didn't think so. I remapped the drives being sure I was *not* an Administrator, and now VB runs under User mode. Thanks.

Tags for this Thread

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