[b][red]This message was edited by ceramicbrad at 2003-3-21 19:40:6[/red][/b][hr]
I am having trouble understanding the reason why the following code works as a string:
******
Public sub button_click(byval sender as object,byval e as system.eventargs)handles button.click
Dim clicks as string
Session("Clicks") = Session("Clicks") + 1
response.write("# of clicks: " & session("clicks"))
end sub
********************************
But the following does not work as an integer:
******************************
public sub button_click(byval...)
Dim x as integer
Session(x) = Session(x) + 1
response.write("#:" & session(x))
end sub
********
any help to clear this issue would be appreciated...
Comments
To make this work try Session("x") += 1
This would increment the value of the Session object by 1.
All Session objects must be in quotes. You can declare the Session object in the global.asax file but that isn't aren't required.
Normally I do declare them to have a list of what I am using for Session objects.
Session("clicks") = ""
Session("x") = 0
Session objects can be of any datatype and the CLR figures out which to use by the data that's passed into it.
I hope that helps.
: [b][red]This message was edited by ceramicbrad at 2003-3-21 19:40:6[/red][/b][hr]
: I am having trouble understanding the reason why the following code works as a string:
:
: ******
: Public sub button_click(byval sender as object,byval e as system.eventargs)handles button.click
:
: Dim clicks as string
: Session("Clicks") = Session("Clicks") + 1
: response.write("# of clicks: " & session("clicks"))
:
: end sub
:
: ********************************
: But the following does not work as an integer:
:
: ******************************
:
: public sub button_click(byval...)
: Dim x as integer
: Session(x) = Session(x) + 1
: response.write("#:" & session(x))
: end sub
:
: ********
:
:
: any help to clear this issue would be appreciated...
:
:
:
:
:
:
Brad