Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Arrays in vb.net

Status
Not open for further replies.

tek2002

Programmer
Aug 21, 2001
67
0
0
US
I have this array that gets emptied every time i do a page submit and i would like to retain the information in the array.

One solution is to create a hidden text box and to store the contents of the array in the textbox each time the page gets sumbitted then load the textbox contents back into the array when the page gets displayed.

Does anyone have any other alternative solution that they have used and found to be effecient?

Thanks
 
what is it that i should put in the viewstate of the page?
also do you have any sample code.

thanks
 
You need to get to the ASP.Net forum, 855. For help on ViewState, bring up your help file, either in the IDE or the MSDN CD, select Index and type ViewState Property. You want "Saving Web Forms Page Values using Viewstate."

Forms/Controls Resizing/Tabbing Control
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
just wanted to post the answer to my question that i found:

I basically had an array that i was filling in a vb.net application that worked fine but when i tried using that array in a vb.net web application, it failed b/c the array was emptied each time i posted so the solution was to save my values in viewstate and when i needed to utilize the array, i would just load those values back into the array via read from viewstate.....it works perfect in my app.

Dim VWarray as string

'save in viewstate
VWarray("VWarray") = CStr(i) + txtName.Text

'read from viewstate
VWarray = CStr(Viewstate("VWarray"))

'at this point, i just looped thru the string value
stored in VWarray and loaded them into my array.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top