Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 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 September 1st, 2004, 07:04 PM
Authorized User
 
Join Date: Aug 2004
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Arsi
Default Need help with foreach loop

I keep getting this error: [Path\ThisWorkbook.cs(161)]: The type or namespace name 'Projects' could not be found (are you missing a using directive or an assembly reference?)
What am I doing wrong? Any input would be appreciated.:D
      protected void ThisWorkbook_BeforeSave(bool save, ref bool Cancel)
        {
            string cell = "0";
            string ot = "0";
            foreach(Projects p in selectedList)
            {
                // get regular hours
                cell = "N" + p.GetRowPos().ToString();
                p.SetUHours(Convert.ToInt32(xlSheet.get_Range(cell , cell).Value2.ToString()));
                // get over time hours
                ot = "V" + p.GetRowPos().ToString();
                p.SetOTHours(Convert.ToInt32(xlSheet.get_Range(ot, ot).Value2.ToString()));
                UpdateData(p);
            }
        }

*******(*)*******
__________________
*******(*)*******
 
Old September 1st, 2004, 08:26 PM
Kep Kep is offline
Authorized User
 
Join Date: Aug 2003
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The compiler doesn't know what the Projects type is. What is the Projects type and where does it come from?

If it's part of the .NET framework then all you need to do is specify the fully qualified name of the type or include a using clause to the correct namespace.

If it's part of a separate module then you'll need to add a reference to that module in your assembly.

Kep.
 
Old September 2nd, 2004, 01:18 PM
Authorized User
 
Join Date: Aug 2004
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Arsi
Default

Oops! I feel kind of dumb because that is the name of the class i created, but I spelled it wrong. Anyway, I figured it out thank you for your help.

*******(*)*******
 
Old September 7th, 2004, 09:41 PM
Authorized User
 
Join Date: Jul 2004
Posts: 69
Thanks: 0
Thanked 1 Time in 1 Post
Default

Happens more often than you could ever imagine. I do it about once or twice a month at least. :)

www.CoderForRent.com
Get A Computer Job!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch. 4 - Foreach loop container Rhywun BOOK: Professional SQL Server 2005 Integration Services ISBN: 0-7645-8435-9 1 May 5th, 2007 08:31 AM
Does foreach loop support datareader deb_kareng C# 1 February 23rd, 2007 05:30 AM
ForEach Loop Bushido121 BOOK: Professional SQL Server 2005 Integration Services ISBN: 0-7645-8435-9 0 October 23rd, 2006 07:55 PM
Getting Error in foreach loop for DataSet bravipandey ADO.NET 2 September 28th, 2005 06:43 PM
foreach loop not working rajanikrishna Beginning PHP 1 November 3rd, 2003 04:14 AM





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