Drives collection not including NAS drive

Not open for further replies.


New member
Nov 5, 2021
Programming Experience

Can anyone tell me why my Lenovo Network Attached Storage is not included in the Drives collection?

This NAS shows in File Explorer in Windows 10, and is assigned drive letter W:, where I can add, retrieve, delete files as I do any other drive.

Thanks to anyone who can solve this.

I have included a screenshot of File Explorer and a simple snippet of code.



  • File Explorer Screenshot.pdf
    57.9 KB · Views: 9
  • Code.txt
    382 bytes · Views: 9
Last edited:
For Each drive In System.IO.DriveInfo.GetDrives()
    If drive.DriveType = IO.DriveType.Network Then
    End If

Maybe it's detected as different type?
For future reference, please don't attach files that we have to download and process separately. Post code as text, formatted as code for readability and post screenshots directly too. Do what you can to help us help you, which means everything being visible and accessible in your post if at all possible.
As for the issue, I'm not sure why it's not working. I just mapped a share on a NAS of mine such that it looks much like your screenshot, then used your exact code and the mapped drive was listed.



You ought to be debugging your code though, and doing so before posting here. Set a breakpoint at the top of that code (F9) and then step through the code line by line and actually look at the data in use. You can see each drive as it gets processed and see what its DriveType is. You can then get a better idea of what problem you're actually trying to solve, e.g. is the drive not processed or does it have a different drive type or is your code not even being executed.

Debugging is a core skill of any developer, second only to writing the code that contains the bugs in the first place. Now is the time to learn how to do it, while your code is still very simple, so you can grow your debugging skills with your coding skills. Whenever you have an issue, debug first and then, if you still need help, provide us with the information you discovered while debugging, e.g. what data was different to your expectation and on what line of code.
I truly thank you jmcilhinney

I am sorry for my lack of understanding of forums and programming.

I am still using VB6 and just sent that code snippet to show that vb.Net also cannot find the drive.

My program is a horse racing analysis program (analysing race meetings in Western Australia) written in VB6.

The program is on all my computers but the data files are on a portable USB drive and I move that drive to whatever computer I am using at the time.

When the program first runs I use code (like I sent), to loop through all drives (using FileSystemObject) to find the USB drive which has the volume name 'WestAust'' and I set a variable called MainDrive to that drive letter.

I want to replace the USB drive with the NAS drive.

That is all I want to do.

Thank you
Based on my testing of the code you provided, VB.NET can find the drive. You have been dishonest about the nature of the problem and the language you're using and we have spent time trying to solve a problem you're not actually having. If you actually need help with VB6 code then this is not the place to find it. You're welcome back if and when you actually have a VB.NET problem.
Not open for further replies.