|
-
Apr 22nd, 2020, 10:56 AM
#1
Thread Starter
Lively Member
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
-
Apr 22nd, 2020, 11:24 AM
#2
Re: Can't access a mapped drive
 Originally Posted by coffent
* 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".
-
Apr 22nd, 2020, 01:25 PM
#3
Thread Starter
Lively Member
Re: Can't access a mapped drive
Thanks - one problem solved. Now for the other one
-
Apr 22nd, 2020, 01:57 PM
#4
Thread Starter
Lively Member
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.
-
Apr 23rd, 2020, 03:40 AM
#5
Lively Member
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.
-
Apr 23rd, 2020, 01:44 PM
#6
Thread Starter
Lively Member
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).
-
Apr 23rd, 2020, 02:00 PM
#7
Re: Can't access a mapped drive
 Originally Posted by coffent
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.
-
Apr 23rd, 2020, 09:57 PM
#8
Thread Starter
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|