TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Raghavendra Shetty
NA
13
6.1k
Skiping the Not accessible directory
Feb 26 2011 9:13 AM
I have written a code for populating the folder structure into tree view. But whenever the folder is not accesible its throwing an error or keeps waiting. I want it to skip that folder and move to next folder. Below is my code
Private Sub BuildDirectoryTree()
Dim newDirectory As TreeNode
Dim justTheSubdirectory As String
Dim basePath as String = "C:\"
For Each oneDirectory As String In My.Computer.FileSystem.GetDirectories(basePath)
justTheSubdirectory = My.Computer.FileSystem.GetName(oneDirectory)
If (fromNode Is Nothing) Then
newDirectory = FrmTreeViewDirectory.Nodes.Add(justTheSubdirectory)
Else
newDirectory = fromNode.Nodes.Add(justTheSubdirectory)
End If
BuildDirectoryTree(newDirectory, My.Computer.FileSystem.CombinePath(basePath, justTheSubdirectory))
Next oneDirectory
End Sub
Can any one modify this and post it back so that it works for the folders that its accessible
Reply
Answers (
9
)
Creating a setup file with database connections
Reading loaded form data