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: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5
This is the forum to discuss the Wrox book Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter Kit by David Sussman, Alex Homer; ISBN: 9780764588075
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 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 Display Modes
  #1 (permalink)  
Old December 17th, 2008, 02:53 PM
Registered User
 
Join Date: Dec 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 7

I keep getting an error code for line 27 and 37. I copied this
directly from the book and even downloaded the source code and still
come up with these 2 errors in Chapter 7

Error 1 'items' is not a member of 'ShoppingCart'.
C:\Websites\PPQ\skeleton\App_Code\StoredShoppingCa rt.vb 27
16 C:\...\skeleton\

Error 2 Argument not specified for parameter 'ItemPrice'
of 'Public Sub Update(MenuItemID As Integer, ItemSize As String,
itemName As String, ItemPrice As Decimal, Quantity As Integer)'.
C:\Websites\PPQ\skeleton\App_Code\StoredShoppingCa rt.vb 37
9 C:\...\skeleton\


Here is my code below:

Imports Microsoft.VisualBasic
Imports System.Collections.Generic


Public Class StoredShoppingCart


Public Shared Function Read() As ShoppingCart

Return FetchCart()

End Function


Public Shared Function Update(ByVal DeliveryCharge As Decimal) As Integer

Dim cart As ShoppingCart = StoredShoppingCart.FetchCart()

cart.DeliveryCharge = DeliveryCharge

End Function

Public Shared Function ReadItems() As List(Of CartItem)

Dim cart As ShoppingCart = StoredShoppingCart.FetchCart()

Return cart.items (THIS IS LINE 27)


End Function


Public Shared Function UpdateItem(ByVal MenuItemID As Integer, ByVal ItemSize As String, ByVal Quantity As Integer) As Integer

Dim cart As ShoppingCart = StoredShoppingCart.FetchCart()

cart.Update(MenuItemID, ItemSize, Quantity) (THIS IS LINE 37)

End Function


Public Shared Function DeleteItem(ByVal MenuItemID As Integer, ByVal ItemSize As String) As Integer

Dim cart As ShoppingCart = StoredShoppingCart.FetchCart()

cart.Delete(MenuItemID, ItemSize)

End Function


Public Shared Function InsertItem(ByVal MenuItemID As Integer, ByVal ItemName As String, ByVal ItemSize As String, ByVal Quantity As Integer, ByVal ItemPrice As Decimal) As Integer

Dim cart As ShoppingCart = StoredShoppingCart.FetchCart()

cart.Insert(MenuItemID, ItemSize, ItemName, ItemPrice, Quantity)

End Function




Private Shared Function FetchCart() As ShoppingCart


Dim cart As ShoppingCart = _
DirectCast(HttpContext.Current.Session("Cart"), ShoppingCart)


If cart Is Nothing Then
cart = New ShoppingCart()
HttpContext.Current.Session("Cart") = cart
End If

Return cart

End Function


End Class
  #2 (permalink)  
Old December 17th, 2008, 04:57 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Hello.

I am not familiar with this book but I think I can point you in the right direction as to why you are getting these errors.

First and foremost, checkout the errata: http://www.wrox.com/WileyCDA/WroxTit...Cd-ERRATA.html

Are any of your errors listed there?

Next, I can explain to why you are getting the errors but not necessarily how to fix them since I don't have a copy of the code at hand. The examples below *should* be able to set you on the right path to some degree.

Your error on line 37 says:

Error 2 Argument not specified for parameter 'ItemPrice'
of 'Public Sub Update(MenuItemID As Integer, ItemSize As String,
itemName As String, ItemPrice As Decimal, Quantity As Integer)'.
C:\Websites\PPQ\skeleton\App_Code\StoredShoppingCa rt.vb 37
9 C:\...\skeleton\


What the compiler is telling you is the the Update method expects n number of parameters but you have not supplied values for the parameter ItemPrice (the forth parameter) and, subsequently, you haven't provided a value for Quantity.

In your UpdateItem function you do this:
vb Code:
cart.Update(MenuItemID, ItemSize, Quantity)

You would, as the code is wrote, need to do something like this:
vb Code:
cart.Update(MenuItemID, ItemSize, Quantity, 0, 0)

This will remove the error from your application, however, you are passing in 0 for the ItemPrice and quantity which, as one might imagine, is undesirable.

Your second error seems related to the ShoppingCart class not having an 'Items' property. It would look something like this:

vb Code:
Property Items() As List(Of CartItem)
        Get
           Return <listvariable>
        End Get
        Set(ByVal Value As List(Of CartItem))
            <listvariable> = Value
        End Set
    End Property

Let me know if I can be of further assistance!

hth.
-Doug
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================
 


Thread Tools
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 2 - End of chapter exercises whizzkid1892 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 July 30th, 2008 12:02 PM
chapter 7 - chapter 11 pelopito BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 3 January 6th, 2008 10:40 AM
Generics chapter 12 difficult chapter i found ...? Larryz C# 2005 1 July 4th, 2007 09:40 PM



All times are GMT -4. The time now is 01:15 PM.


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