Populating ListBox of directories

Codeless

Well-known member
Joined
Jan 24, 2003
Messages
59
Location
Great NW
I can use the DirectoryInfo class to find local directories to populate my ListBox server control, but when I try to use it on a network share which uses a different usr and pwd, I get an error. I dont see how to change them to get a list of directories.

I looked into the DirectoryEntry and DirectoryEntries classes where I can specify a usr and pwd, but I cant get at the children for some reason.

any tips, hints or code examples are greatly appreciated.
:confused:
 
Have you explored this class?
Dim x As New System.Net.NetworkCredential("username", "password")
 
Nope, Thanks for the hint.

For anyone else who happens to view this, I have a mapped drive ("V:\") that is mapped to a share name on a unix server ("\\engs025-ef0\AE"). I want to be able to read the names of the directories at run time and put them in a ListBox. Seems pretty simple, but every time I try and run the command:

Dim mysubs As string() = Directory.GetDirectories(TargetDirectory)

I get an error "Network password is not correct".

How do I specify the network password? Also I am running as a local admin with full permissions. Thanks.
 
Back
Top