![]() |
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 ------------------------------------------------------------------------ |
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.