asp.net help! i keep getting "null reference excetption: Object reference not set

Icecream

New member
to an instance of an object.? i want to link items from a listbox in page 1 to page 2 when you click the next button in page 1... here's what i did:

Public Class OfficialRCPT
Inherits System.Web.UI.Page
Protected WithEvents litOne As System.Web.UI.WebControls.Literal

Dim Receipt As String

Public Property YourOrder() As String
Get
Return Receipt
End Get
Set(ByVal value As String)
Receipt = value
End Set
End Property

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim order As New OfficialRCPT

order.YourOrder = lstorders.Text

Session.Add("Your Final Order", order)
Response.Redirect("default2.aspx")

End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim order As OfficialRCPT = Session.Item("YourOrder")
Label10.Text = order.YourOrder
End Sub

the error occurs in the line "Label10.text = order.YourOrder" what's wrong?? i think i should declare something "as NEW" but where??? help please? :)
Thank you Daniel B, im not getting the error anymore! :) the problem now is, the list still doesnt appear in label10...:(
 
Back
Top