| re: Problems with public variables
Thanks for your anwer Bill,
I've solve my problem using public variables in a module but I wasn't aware
about the fact the public or shared variables in a class/module would be
shared across the entire application (for every sessions). Thats an
important issue to consider.
Thanks again
Jose
"William Ryan" <dotnetguru@comcast.nospam.net> wrote in message
news:u8YE5WIpDHA.392@TK2MSFTNGP11.phx.gbl...[color=blue]
> They won't, every time a postback occurs on the page, they'll be reset.
> Using Public Variables in any context isn't probably a good idea...you can
> use a class in general with Static or shared properties depending on your
> prog language. However, in ASP.NET, a module for instance will be shared
> among ALL Users which is seldom desireable.
>
> Instead, store things in Session Variables. They give you the same effect
> as public, are isolated to the session and can be strongly typed. The[/color]
best[color=blue]
> of all worlds.
>
> Session("SomeNameForAVariable") = someObject
>
> Dim someNewObject as someObject
> someNewObject = CTYpe(Session("SomeNameForAVariable"), someObject)
>
> You can hit this from any page in your app.
> HTH,
>
> Bill
> "Jose Meireles" <jmeireles@myconnections.biz> wrote in message
> news:%23Ti6x7ApDHA.488@tk2msftngp13.phx.gbl...[color=green]
> > Hi everyone,
> >
> > I'm trying to use public variables in a web form to hld specific values.
> > What happens is that the public variables (declared as public x as y in[/color]
> the[color=green]
> > beginning of the class), doesn't seem to hold the value from function[/color][/color]
call[color=blue][color=green]
> > to function call.
> >
> > Does anyone can help me abou this?
> >
> > best regards
> >
> > JM
> >
> >[/color]
>
>[/color] |