Government Security
Network Security Resources

Jump to content

Photo

Vb.net error handling help

- - - - -
  • Please log in to reply
1 reply to this topic

#1 loxaXcracker

loxaXcracker

    Private

  • Members
  • 4 posts

Posted 22 July 2008 - 11:51 AM

Hello, i need some help with something im doing in vb.net 2005.

I am trying to get a list of all directories that i have in "My documents" folder (I am using vista btw..) and I use this simple code:
For Each str1 In My.Computer.FileSystem.GetDirectories("C:\Users\loxaXcracker\Documents", FileIO.SearchOption.SearchAllSubDirectories)
					 TextBox1.Text = TextBox1.Text + str1 & vbCrLf
				 Next
The problem is, that the "My music" foder access is denied (and i am the admin of the pc). I tried exception handling and it doesn't give the error that it used to but what I really want it to do, is to ignore the "Not accessible" error and just continue to the next file.
Here's what i tried:
Try
				 For Each str1 In My.Computer.FileSystem.GetDirectories("C:\Users\loxaXcracker\Documents", FileIO.SearchOption.SearchAllSubDirectories)
					 TextBox1.Text = TextBox1.Text + str1 & vbCrLf
				 Next
						Catch ex As UnauthorizedAccessException
			 End Try
Thanks in advance.

#2 saviolan

saviolan

    Private

  • Members
  • 3 posts

Posted 27 June 2010 - 04:38 AM

check with following urls

http://vb.net-inform..._exceptions.htm

http://vb.net-inform...tion_strict.htm

http://vb.net-inform..._error_goto.htm

savs