|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
System Volume Informationexception with "System Volume Information". Obviously it's a region I'm not supposed to access so I'm trying to filter it out by checking for the folder name before trying to use it: If Folder.Name <> "System Volume Information" Then GetFolderDetails(Folder) End If But for some reason the if statement is not matching and I'm getting a run time exception within my GetFolderDetails because it is trying to access the files in that folder. Can anyone explain why it doesn't get caught by my if? -- ______ ___ __ /_ __/_ __/ _ )_______ ___ _/ /_____ ____ / / / // / _ / __/ -_) _ `/ '_/ -_) __/ /_/ \_, /____/_/ \__/\_,_/_/\_\\__/_/ /___/ There are 10 types of people in this world; those who understand the binary numbering system and those who don't. There's no place like 127.0.0.1. ASCII a silly question, get a silly ANSI. First of all, what is the value of Folder.Name when you hit the folder in
question? I notice that I can access the 'System Volumne Information' folder on my stystem drive but not on any of my other local hard drives where I get an 'Access Denied'. Wrap your GetFolderDetails(Folder) call in a try catch and handle the exception. Show quoteHide quote "TyBreaker" <tybreakerNO@SPAMhotmail.com> wrote in message news:%23fPh0P3UGHA.5468@TK2MSFTNGP14.phx.gbl... > Hi, I'm iterating through the folders on my system and am getting an > exception with "System Volume Information". Obviously it's a region I'm > not supposed to access so I'm trying to filter it out by checking for the > folder name before trying to use it: > > If Folder.Name <> "System Volume Information" Then > GetFolderDetails(Folder) > End If > > But for some reason the if statement is not matching and I'm getting a run > time exception within my GetFolderDetails because it is trying to access > the files in that folder. Can anyone explain why it doesn't get caught by > my if? > -- > ______ ___ __ > /_ __/_ __/ _ )_______ ___ _/ /_____ ____ > / / / // / _ / __/ -_) _ `/ '_/ -_) __/ > /_/ \_, /____/_/ \__/\_,_/_/\_\\__/_/ > /___/ > > There are 10 types of people in this world; those who understand the > binary numbering system and those who don't. > > There's no place like 127.0.0.1. > > ASCII a silly question, get a silly ANSI. Stephany Young wrote:
> First of all, what is the value of Folder.Name when you hit the folder in Well according to the break point I have in my GetFolderDetails routine, > question? the argument passed to the routine is the string "System Volume Information" which is why I'm puzzled that my if statement doesn't catch it. I shall double check with some debugging output. > Wrap your GetFolderDetails(Folder) call in a try catch and handle the If I have to use Try...Catch I will but I dislike that particular > exception. construct as it tends to hide where errors are coming from so was hoping to use an if statement to make it obvious as to why I did it. -- ______ ___ __ /_ __/_ __/ _ )_______ ___ _/ /_____ ____ / / / // / _ / __/ -_) _ `/ '_/ -_) __/ /_/ \_, /____/_/ \__/\_,_/_/\_\\__/_/ /___/ There are 10 types of people in this world; those who understand the binary numbering system and those who don't. There's no place like 127.0.0.1. ASCII a silly question, get a silly ANSI. Hello TyBreaker,
There can be a number of folders you can't access on any volume. Even the System Restore folder can have a different name than System Volume Information. So you should trap any exception while accessing the file system. In your case, you can use something like this: Try GetFolderDetails(Folder) Catch ex As UnauthorizedAccessException 'Do something, like maintain a list of inaccesible folders. End Try Regards. Show quoteHide quote "TyBreaker" <tybreakerNO@SPAMhotmail.com> escribió en el mensaje news:%23fPh0P3UGHA.5468@TK2MSFTNGP14.phx.gbl... | Hi, I'm iterating through the folders on my system and am getting an | exception with "System Volume Information". Obviously it's a region I'm | not supposed to access so I'm trying to filter it out by checking for | the folder name before trying to use it: | | If Folder.Name <> "System Volume Information" Then | GetFolderDetails(Folder) | End If | | But for some reason the if statement is not matching and I'm getting a | run time exception within my GetFolderDetails because it is trying to | access the files in that folder. Can anyone explain why it doesn't get | caught by my if? | -- | ______ ___ __ | /_ __/_ __/ _ )_______ ___ _/ /_____ ____ | / / / // / _ / __/ -_) _ `/ '_/ -_) __/ | /_/ \_, /____/_/ \__/\_,_/_/\_\\__/_/ | /___/ | | There are 10 types of people in this world; those who understand the | binary numbering system and those who don't. | | There's no place like 127.0.0.1. | | ASCII a silly question, get a silly ANSI.
Update Access data
My computer seems to be to slow to run VS2005 Translation of CreateFile dll in dot net REPOST: preventing more than one user from working on the same record Calendar with custom tooltip over days with events XML into datagrid Using Find method on a List(of type) Breaks the Reference VB.NET error Locked Control Using Class's and multiThreading |
|||||||||||||||||||||||