Memory problem

lothos12345

Junior Contributor
Joined
May 2, 2002
Messages
294
Location
Texas
I have declared an integer outside the private sub statement. So it will hold it value after the event has been executed. This works fine in Window Applications, however this does not seem to work in webforms. Is there away in VB.NET for webforms that I can make a variable keep its value after an event has beem executed? Any help with this question would be greatly appreciated.
 
You can assign the value to a Session object.
Visual Basic:
dim temp as string = "hello"

Session("SomeVar") = temp

'then after postback you can get its value like this....

dim temp as string

if not Session("SomeVar") is nothing then
     temp =  convert.tostring(Session("SomeVar"))
end if
 
Back
Top