views:

31

answers:

2

First of all, here comes the load part.

Structure MainStruct
        Dim Ans1 As String
        Dim Ans2 As String
 End Structure


Dim Build As New List(Of MainStruct)
...
...
...

Session("MyData") = Build

The question is how can i read back the contents of the list, stored in the Session? I mean something like...

Build = Session("MyData")
+2  A: 

Instead of Build = Session("MyData").Ans1 you will want to do

Build = CType(Session("MyData"), List(Of MainStruct))

You could also do a DirectCast instead of CType if you want.

Edit: to question change

To then read back the results you will be able to go through Build.

You could loop through it with a for each, a for, some linq, whatever you want!

msarchet
+1  A: 

Since its VB i dont think u need to cast it back, correct me if im wrong.

i dont think u can just do

Build = Session("MyData").Ans1

You need to do something like:

Build = Session("MyData")

then u iterate though ur List<> to access the structs

Ephraim L.
Thanks! I already updated the question
Chocol8
It depends on what compiler options are set. If you're using Option Strict as you should be, you will need the cast.
Joel Coehoorn