How would I be able to make a variable that holds t开发者_运维知识库he value of the directories that exist in the C:\?
The DirectoryInfo class has member functions to do that - GetDirectories in this case.
Imports System.IO Dim fTarget As New IO.DirectoryInfo("C:\") Dim arrAnswer as DirectoryInfo() arrAnswer = fTarget.GetDirectories()
The simplest option is to call GetDirectories on the static type Directory. This can be found in System.Io. It returns a string array of directories that it finds. You can also specify if it should drill down into subcategories when it is called
See msdn for more info http://msdn.microsoft.com/en-us/library/system.io.directory.getdirectories.aspx
精彩评论