Adding an Array to viewstate

B

bob

I am a newbie. How do I add an array to a viewstate, then retreive the
individual elements?

Right now, I made an array with random numbers and when I go to access an
element from different buttons, if I access
the same element, it looks like it is putting new random numbers in the
array. I just want to establish an array only once with random numbers, and
being able to get the same answers when ever I access the elements of the
array.

Should I put the array in the init or the load page?

TIA
 
R

Raterus

should be as simple as this..

Dim myArray() As String = {"abc", "def", "ghi"}
viewstate("myarray") = myArray
Dim anotherArray() As String = CType(viewstate("myarray"), String())
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top