Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8
This is the forum to discuss the Wrox book Beginning ASP.NET 2.0 by Chris Hart, John Kauffman, David Sussman, Chris Ullman; ISBN: 9780764588501
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 12th, 2006, 03:48 PM
Authorized User
 
Join Date: Aug 2006
Location: , , .
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 9, Try it out Page 338, C#

Why am i getting this?

Server Error in '/Chapter09' Application.
--------------------------------------------------------------------------------

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0246: The type or namespace name 'Vehicle' could not be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 36: }
Line 37:
Line 38: public class Car : Vehicle
Line 39: {
Line 40: public Car()


Source File: e:\Websites\Beginning ASP.NET 2.0_CS_CodeDownload\Begin\Chapter09\App_Code\Vehic les.cs Line: 38



Show Detailed Compiler Output:


C:\Documents and Settings\tbroom> "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc .exe" /t:library /utf8output /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0 .0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.EnterpriseSer vices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseS ervices.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0 __b77a5c561934e089\System.Xml.dll" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\m scorlib.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Service s\2.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dl l" /R:"C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__ b03f5f7f11d50a3a\System.Web.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0_ _b77a5c561934e089\System.Data.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Mobile\ 2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b7 7a5c561934e089\System.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Configurati on\2.0.0.0__b03f5f7f11d50a3a\System.Configuration. dll" /out:"C:\Documents and Settings\tbroom\Local Settings\Temp\Temporary ASP.NET Files\chapter09\26f59e91\ac283f13\App_Code.irzb5zo e.dll" /D:DEBUG /debug+ /optimize- /w:4 /nowarn:1659;1699 "C:\Documents and Settings\tbroom\Local Settings\Temp\Temporary ASP.NET Files\chapter09\26f59e91\ac283f13\App_Code.irzb5zo e.0.cs" "C:\Documents and Settings\tbroom\Local Settings\Temp\Temporary ASP.NET Files\chapter09\26f59e91\ac283f13\App_Code.irzb5zo e.1.cs"


Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.42
for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.

e:\Websites\Beginning ASP.NET 2.0_CS_CodeDownload\Begin\Chapter09\App_Code\Vehic les.cs(38,20): error CS0246: The type or namespace name 'Vehicle' could not be found (are you missing a using directive or an assembly reference?)
e:\Websites\Beginning ASP.NET 2.0_CS_CodeDownload\Begin\Chapter09\App_Code\Vehic les.cs(48,21): error CS0246: The type or namespace name 'Vehicle' could not be found (are you missing a using directive or an assembly reference?)
e:\Websites\Beginning ASP.NET 2.0_CS_CodeDownload\Begin\Chapter09\App_Code\Vehic les.cs(58,27): error CS0246: The type or namespace name 'Vehicle' could not be found (are you missing a using directive or an assembly reference?)





Show Complete Compilation Source:


Line 1: using System;
Line 2: using System.Data;
Line 3: using System.Configuration;
Line 4: using System.Web;
Line 5: using System.Web.Security;
Line 6: using System.Web.UI;
Line 7: using System.Web.UI.WebControls;
Line 8: using System.Web.UI.WebControls.WebParts;
Line 9: using System.Web.UI.HtmlControls;
Line 10:
Line 11: /// <summary>
Line 12: /// Summary description for Vehicles
Line 13: /// </summary>
Line 14: public class Vehicles
Line 15: {
Line 16: protected int _wheels;
Line 17: protected int _topSpeed;
Line 18: protected string _warningSound;
Line 19:
Line 20: public int Wheels
Line 21: {
Line 22: get { return _wheels; }
Line 23: set { _wheels = value; }
Line 24: }
Line 25:
Line 26: public int TopSpeed
Line 27: {
Line 28: get { return _topSpeed; }
Line 29: set { _topSpeed = value; }
Line 30: }
Line 31:
Line 32: public virtual string Warning()
Line 33: {
Line 34: return _warningSound;
Line 35: }
Line 36: }
Line 37:
Line 38: public class Car : Vehicle
Line 39: {
Line 40: public Car()
Line 41: {
Line 42: _wheels = 4;
Line 43: _topSpeed = 150;
Line 44: _warningSound = "Honk";
Line 45: }
Line 46: }
Line 47:
Line 48: public class Bike : Vehicle
Line 49: {
Line 50: public Bike()
Line 51: {
Line 52: _wheels = 2;
Line 53: base.TopSpeed = 30;
Line 54: _warningSound = "Ring Ring";
Line 55: }
Line 56: }
Line 57:
Line 58: public class Skateboard : Vehicle
Line 59: {
Line 60: public Skateboard()
Line 61: {
Line 62: _wheels = 4;
Line 63: _topSpeed = 15;
Line 64: }
Line 65:
Line 66: public override string Warning()
Line 67: {
Line 68: return "No warning - you'll have to shout yourself";
Line 69: }
Line 70: }
Line 71:

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

  #2 (permalink)  
Old October 3rd, 2006, 03:43 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Banbury, , United Kingdom.
Posts: 105
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to DanM
Default

Hi there,

It looks like your problem here is that in Line 14, you've called your class Vehicles (with an 's') rather than Vehicle (without an 's').
The error is raised on line 38 because the compiler is looking for a class called Vehicle which doesn't exist.

Hope that helps, Dan

Dan Maharry
Read the feed at http://feeds.feedburner.com/dansarchive
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 5 Page 132 Durb BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 3 December 20th, 2008 10:44 AM
Chapter 9, page 304 Again AspNetGuy BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 June 15th, 2008 02:57 PM
Chapter 7 Try It Out page 218 drumdiva BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 3 March 19th, 2007 08:35 PM



All times are GMT -4. The time now is 04:45 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.