Wrox Programmer Forums
|
BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio
This is the forum to discuss the Wrox book ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solution by Vincent Varallo; ISBN: 9780470396865
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio 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 August 2nd, 2012, 04:47 PM
Registered User
 
Join Date: Aug 2012
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default Chapter 4: ForEach Error b/c ENTBaseEOList does not contain GetEnumerator

I am implemeting this soulution using Visual Studio 2010 and SQL Express. For the most part I have been able to get through Chap 4 (page 88) except for the use of the 'ForEach' statement when referencing the ENTMenuItemBOList reference.
eg.
foreach (ENTMenuItemBO mi in MenuItems)

I am getting a compile error that the ENTMenuItemBOList does not contain a public declaration for 'GetEnumeration'.

This is happening for the 'foreach' statement in the MenuTabs.cs and the ENTMenuItemBO.cs file.

Did I miss some code somewhere or is there something different between VS 2008 and VS 2010?
 
Old September 26th, 2012, 11:28 AM
Registered User
 
Join Date: Sep 2012
Posts: 5
Thanks: 0
Thanked 1 Time in 1 Post
Default

On the assumption that you have not made any changes to the original code that would cause this error, the first thing I would check is to see if the menu options are even there. There is an actual check in the code (MenuTabs.cs approx line 43 where it says "if(MenuItems != null)" If MenuItems has not been populated then this should be null and the message "Top Menu Goes Here" should be displayed. If for any reason it got through that check and it is empty or null when it gets to the foreach loop it will crash. Granted, the error you got isn't very clear but that's what it means.

To find out for sure, put a stop on the foreach line and do a debug. When it gets to that line just mouseover MenuItems and see what pops up. It shouldn't be null or you would never have gotten here but it could be empty.


Quote:
Originally Posted by RWoodmansee View Post
I am implemeting this soulution using Visual Studio 2010 and SQL Express. For the most part I have been able to get through Chap 4 (page 88) except for the use of the 'ForEach' statement when referencing the ENTMenuItemBOList reference.
eg.
foreach (ENTMenuItemBO mi in MenuItems)

I am getting a compile error that the ENTMenuItemBOList does not contain a public declaration for 'GetEnumeration'.

This is happening for the 'foreach' statement in the MenuTabs.cs and the ENTMenuItemBO.cs file.

Did I miss some code somewhere or is there something different between VS 2008 and VS 2010?
The Following User Says Thank You to Mark Bedell For This Useful Post:
RWoodmansee (September 26th, 2012)
 
Old September 26th, 2012, 11:46 AM
Registered User
 
Join Date: Aug 2012
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks for the reply. I found the root issue a couple of days ago. I don't remember exactly which reference it was, but I was missing a 'using ...' reference that caused a few things to fail the compiler.....





Similar Threads
Thread Thread Starter Forum Replies Last Post
foreach tedr BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950 1 January 27th, 2010 06:07 PM
Foreach in Chapter 6 sgtwwilson BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 2 January 22nd, 2010 08:57 PM
Getting Error in foreach loop for DataSet bravipandey ADO.NET 2 September 28th, 2005 06:43 PM
"foreach" error BradBrening Pro PHP 2 January 13th, 2005 05:33 PM
php foreach error - will pay fgraph Beginning PHP 0 December 6th, 2004 10:46 PM





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