471,089 Members | 1,088 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,089 software developers and data experts.

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
------------------------------------------------------------------------

Jun 26 '06 #1
1 1901
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
------------------------------------------------------------------------

Jun 26 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Earl Teigrob | last post: by
1 post views Thread by aliendolphin | last post: by
3 posts views Thread by Mrs. Conni Drejer | last post: by
4 posts views Thread by Mantorok | last post: by
2 posts views Thread by james | last post: by
1 post views Thread by cobus.lombard | last post: by
5 posts views Thread by dougloj | last post: by
4 posts views Thread by =?iso-8859-1?B?Sm9oYW4gU2r2c3Ry9m0=?= | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.