Click here to Skip to main content
15,348,570 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm new to Visual Basic. I can make a directory list, but how do I test whether a folder is a "special folder" or not so I can get the path and access the folder's contents?

What I have tried:

I've tried listing all directories, but I get an error message when I try to open certain folders, such as "My Documents". I may need to open, for instance, a Word file, but I can't if I can't get the correct path.
Posted
Updated 25-May-22 4:58am
Comments
Dave Kreskowiak 24-May-22 16:40pm
   
There is no test. Frankly, I can't think of a reason why you would ever do this. A folder is a folder. The "special" folders are just "well-known" locations in the directory tree. These are starting points to building a path to a file or folder from a "well-known" starting point in the tree.

Start by explaining what you're ultimately trying to do with this. What's the point of the app?
RedDk 24-May-22 18:12pm
   
What are we talking here? Environment.SpecialFolder Enum of System.Runtime.dll? If this is what we're talking here, in order to proceed we'll need some more information. Along the lines of ".NET 3.8" or ".NET what?".

For what it's worth, using the Visual Studio Installer for the version of this software with which you are currently fiddling and ticking Help Viewer then hitting Modify (to download and install) makes it easy to then run the app, tick all the boxes for all the content, once upgraded, then search using keywords and ultimately find the answers to the questions you ask.

1 solution

See if they're in the "Special Folders" list.

https://docs.microsoft.com/en-us/dotnet/api/system.environment.specialfolder?view=net-6.0

Getting All "Special Folders" via VB.NET[^]

How to: Find Files with a Specific Pattern - Visual Basic | 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