Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   convert from static variables to session (http://www.velocityreviews.com/forums/t300876-convert-from-static-variables-to-session.html)

nicepg 06-25-2006 07:28 PM

convert from static variables to session
 

Hi,

i m new in C#, and i m trying to prgramm a calculator program in web
application.

My program work very well using a static variables but i need to change
these variables to session variables..

my static variables are:

public static double num1=0,num2=0;
public static string prevOp="";

could you pleas show me how to do that?

thank you in advance



--
nicepg
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------


=?Utf-8?B?Q2FsdmluIEtE?= 06-26-2006 05:26 AM

RE: convert from static variables to session
 
Hi,
Have you tried:

Session["num1"] = 0;
Session["num2"] = 0;
Session["prevOp"] = string.Empty;
....

To use the assigned values, do this:

if (Session["num1"] != null)
{
decimal num1 = Convert.ToDecimal(Session["num1"]);
}
....

Hope that helps.
Calvin
"nicepg" wrote:

>
> Hi,
>
> i m new in C#, and i m trying to prgramm a calculator program in web
> application.
>
> My program work very well using a static variables but i need to change
> these variables to session variables..
>
> my static variables are:
>
> public static double num1=0,num2=0;
> public static string prevOp="";
>
> could you pleas show me how to do that?
>
> thank you in advance
>
>
>
> --
> nicepg
> ------------------------------------------------------------------------
> Posted via http://www.codecomments.com
> ------------------------------------------------------------------------
>
>



All times are GMT. The time now is 09:11 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57