Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003
This is the forum to discuss the Wrox book Professional VB.NET 2003 by Bill Evjen, Billy Hollis, Rockford Lhotka, Tim McCarthy, Jonathan Pinnock, Rama Ramachandran, Bill Sheldon; ISBN: 9780764559921
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 23rd, 2004, 10:52 AM
Authorized User
 
Join Date: Dec 2003
Location: , , .
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to DolphinBay
Default Chapter 3: Looping through folders error

Good morning,

I am trying to complete the example on page 129 and I am receiving the following error:

An unhandled exception of type 'System.Security.SecurityException' occurred in mscorlib.dll

Additional information: Request for the permission of type System.Security.Permissions.FileIOPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.

My code reads:

        Dim subFolders() As DirectoryInfo
        subFolders = New DirectoryInfo("c:\").GetDirectories
        [ERROR OCCURING ON LINE ABOVE]

        Dim subFolder As DirectoryInfo

        For Each subFolder In subFolders
        lstData.Items.Add(subFolder.FullName)

        [remainder of code omitted]

Can someone please assist and tell me what this error means?

Thanks in advance.

Eric


 
Old March 13th, 2004, 04:14 PM
Registered User
 
Join Date: Mar 2004
Location: Parsippany, NJ, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You should declare namespace outside of the class

On the top of your code, add this line

imports system.io

and you should also have a next corresponding to your For Each statement



 
Old April 7th, 2004, 05:41 AM
Registered User
 
Join Date: Apr 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It is probably due to the fact that your project is stored, and consequently running, on a network drive. So when it tries to reach a local file of your machine, you get a security error.
Try to move your solution on your local disk.





Similar Threads
Thread Thread Starter Forum Replies Last Post
paging folders solomon_13000 Classic ASP Professional 1 May 28th, 2006 09:12 AM
Chapter 9 (Looping) Try It Out melbsurfer BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 2 January 27th, 2006 01:54 PM
Which folders to USE groupmatch BOOK: ASP.NET Website Programming Problem-Design-Solution 5 October 7th, 2004 07:52 PM
Parse error in error handler (Chapter 8) Funky Monk BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 August 6th, 2004 08:59 AM
Chapter 3: Looping through folders error DolphinBay VB.NET 2002/2003 Basics 1 January 23rd, 2004 10:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.