Click here to Skip to main content
15,901,035 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
shared drive is showing perfectly in my computer in windows 10 as shown in following image

https://i.imgur.com/EvgY8k3.png[^]

but when i am trying to open the same shared drive from vb.net program,
it is not showing as a shared drive

instead of, it is showing as \\my-servername\sharedname\...

so why it is not showing as drive letter when opening from vb.net program

I can't access it from vb.net program using drive letter like "D:\"
but i can access it from vb.net program using "my-servername\sharedname\"

so what is the reason behind it ?

What I have tried:

VB
Dim OpenExcel As New OpenFileDialog
OpenExcel.Multiselect = False
OpenExcel.Title = "File Search"
OpenExcel.Filter = "Excel Files|*.xls;*.xlsx;*.xlsm"
OpenExcel.InitialDirectory = "N:\"
OpenExcel.ShowDialog()
Posted
Updated 23-Aug-21 1:52am
Comments
CHill60 16-Aug-21 6:05am    
Are you running this program on the same computer or on the server?
When you say "can't access it" what is actually happening?
Devendra Sarang 16-Aug-21 23:03pm    
https://i.imgur.com/EvgY8k3.png

sir,in this pic, you can share that shared drive is showing as a "N:" drive. Right.

Now when i am opening same shared drive using "OpenFileDialog" on same computer, it is not showing as a "N:" drive, instead of it showing

https://i.imgur.com/QFVk58O.png

Turns out that this is quite common - assuming that those network drives really are blank and not showing as the full UNC path as you implied in your original post.

I found a suggested solution here Can't see network drives in the Open dialog box[^] :
Quote:
1 - run regedit
2. - locate HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Policies/System
3 - create a new DWORD entry with the name EnableLinkedConnections and value 1.
4 - restart your computer
5 - now you can see and use network drives with these installers or applications.
That poster found the solution on the MS tech forum at FolderBrowserDialog does not show network drives on Windows 8[^]

If you have actually obscured the parts of your image and the full UNC paths are being shown in the dialog box, I would suggest trying the above fix first. If that doesn't work then I do question whether or not this is a real problem - as long as the file can be opened ... it does remove any issues where users may have different drive mappings for the same path
 
Share this answer
 
I have found one temporary solution of it.

In app.manifest file, i have removed following line of code

<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>



now "OpenFileDialog" can access shared drive also.

Don't know why it is happning in Windows 10.

If above line is there then "OpenFileDialog" is unable to access shared drive.

If above live is removed then "OpenFileDialog" can access shared drive.
 
Share this answer
 
Comments
Richard Deeming 23-Aug-21 7:55am    
This is a well-known and documented issue:
Mapped drives are not available - Windows Client | Microsoft Docs[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900