SeanGraflund
asked on
keeping variable info in a code behind / class file
I'm using asp.net with vb ...
I've got a webform, a code behind page, and a functions.vb page ...
everything works fine, but I want to share variables between functions ...
on my code behind page, i'll call a function in functions.vb, then it will return to the code behind, where i'll call another function from functions.vb ... when i access functions.vb again, i want some variables to be saved ... basically connection variables, that sort of nature ..
example:
Public Class functions
Dim objConnection as connection
Function SetConnection()
objConnection = whatever
End Function
Function 1()
SetConnection()
End Function
'I want to be able to access the stored info from objConnection here when I called it the last time
Function 2()
End Function
End Class
on my web form:
btn1_click()
functions.Function1()
runthisfunction()
end function
function runthisfunction()
functions.Function2() 'here, i call function2 from the class page, there i want to be able to access objConnection without having to reset the variable ... there's more to this obviously than what i am coding .. but the framework should be the same as in this example ..
end function
thanks!!!
I've got a webform, a code behind page, and a functions.vb page ...
everything works fine, but I want to share variables between functions ...
on my code behind page, i'll call a function in functions.vb, then it will return to the code behind, where i'll call another function from functions.vb ... when i access functions.vb again, i want some variables to be saved ... basically connection variables, that sort of nature ..
example:
Public Class functions
Dim objConnection as connection
Function SetConnection()
objConnection = whatever
End Function
Function 1()
SetConnection()
End Function
'I want to be able to access the stored info from objConnection here when I called it the last time
Function 2()
End Function
End Class
on my web form:
btn1_click()
functions.Function1()
runthisfunction()
end function
function runthisfunction()
functions.Function2() 'here, i call function2 from the class page, there i want to be able to access objConnection without having to reset the variable ... there's more to this obviously than what i am coding .. but the framework should be the same as in this example ..
end function
thanks!!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i was declaring the functions class inside each function ... that would reset the variables :)