Hi
This may be beyond the scope of the book, but I'm working on an assignment for a visual basic class I'm taking.
The goal is to make a store front for a movie store.
I've been able to pass the database record key to a variable in the code-behind of my browse.aspx. When I pass the variable to the ShoppingCart class, I get a null reference exception. My code below isn't exact, but it's close to what I'm working on.
this works fine:
Code:
[browse.aspx button-click event]
Dim cart as New Shopping Cart = nothing
Dim dk as string
dk= detailsview.datakey.value.tostring()
cart.Add(dk)
Then in the ShoppingCart.
vb file I have
Code:
Imports System.Collection
Public Class ShoppingCart
Dim cart as new stringcollection = nothing
Public Sub Add(ByVal value as string)
cart.Add(value)
End Sub
The cart.Add throws a null reference exception and I cannot figure out why. On the other hand, I'm not even sure this is a good way to approach the problem, since once the user navigates to the cart.aspx I have no idea if I'll even be able to access the cart created on browse.aspx
Thanks =)