my.computer.fileinfo

I have been attempting to learn some of the new nifty items in the 2.0 framework, i am trying to search my entire c:\ drive for .jpg files and it throws an exception when it gets to a system directory. I have attempted to set system.securty to the min permissions to no avail, will post code and error when i get home, but if someone else has seen this any help now would be appreciated.


Answer this question

my.computer.fileinfo

  • Brian Welcker


    Try using the FileIOPermission class.

  • Pranav Garg

    ok, i changed the call to the appropriate one, except i dont 'want just the special directory's searched, i want the whole c: drive searched, this is where it throws the error when it gets to a specific directory it throws the error of permissions.

    i'm running xp home with vs2005 express (vb) and have tried to follow the msdn reccomendations on setting or requesting permissions for my software to access to look for jpg files in those directory's to no avail.



  • i_abhor

    code below

    For Each str As String In My.Computer.FileSystem.FindInFiles("c:\", "*.jpg", True, FileIO.SearchOption.SearchAllSubDirectories)

    'instance = Security.Permissions.SecurityAction.RequestMinimum

    tvwMyPictures.Nodes.Add(str)

    exists in the button1_click event (like i said, just doinkin around, but now it has me PEEVED



  • the.cypher

    If you're searching for specific files then you probably don't want to be searching the contents of the file (which is what your code is doing). Also you should perform your search in a Try...Catch block so you can trap exceptions such as those you're encountering.

    See if the following works for you:

    How to: Find Files with a Specific Pattern in Visual Basic



  • my.computer.fileinfo