Code question

T

TCB

I have coded a page something like this (this page contains a Wizard
control):

Private shared p_MyInt as Integer

Sub Page_Load(.....)

If Not(me.ispostback) then
p_MyInt = Request.QueryString("SomeInt")
End If
.... some other stuff

End Sub

At the end of the wizard....

Sub SaveData()

'Calls a class that stores the data
StoreData(p_MyInt,etc,etc,etc)
Response.Redirect("AppResult.aspx")

End Sub

Somehow when StoreData is called, the value of p_MyInt is completelly
different of what it should be, what can cause this change in values?

Thank you all!
 
M

Marina Levit [MVP]

You only have one instance of this variable for every user of your system.
So if I am filling out form 1 but you are on form 3, one of us can overwrite
this variable, and our data will be saved for form 3, when only one of us is
on it.

You should not be using shared variables for user specific information.
 

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

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top