I have a class that I call data that contains a bunch of properties. As the user moves through the pages, certian properties are updated and then written to the database at the end. I am trying to save this class to a session variable like below
but I keep getting the "Object reference not set to an instance of an object." error. The first time a save it to the Session variable it works because I use:
Private cdata As Data = New Dat
cdata = Session("DataClass")
Then on the next page I try to access the Session, write the properties then save it back to the session.
Dim gdata As data = Session("DataClass")
gdata.Subtotal = Me.txtSub.Text
gdata.Tax = Me.txtTax.Text
gdata.SH = Me.txtSH.Text
gdata.TotalPrice = Me.txtTotal.Text
Session("DataClass") = gdata
This is when the error occurs. I was wondering what I am doing wrong.