开发者

How to maintain my data like a session variable in .NET Windows Forms?

开发者 https://www.devze.com 2023-01-03 07:42 出处:网络
I am using .NET Windows Forms. I need to maintain some date to check the condition. So I have to maintain it until the user logs out.

I am using .NET Windows Forms. I need to maintain some date to check the condition. So I have to maintain it until the user logs out.

Like session in ASP.NET.

How can I do this? (Note it should not expire until the user logs out.)

Update:

I create Namespace like this

namespace nsGlobalData {

class GlobalData

{

    public static int GlobalOrgId;

 }

}

To Set:

Glob开发者_如何学GoalData.GlobalOrgId = Convert.ToInt16(ds.Tables[1].Rows[0].ItemArray[0]);

ToGet

txtnamt.text=GlobalData.GlobalOrgId;


class Program
{
    internal static Dictionary<string, object> GlobalVariables = new Dictionary<string, object>();

    static void Main(string[] args)
    {
        ...
    }
}


Just use a static variable in some class?

0

精彩评论

暂无评论...
验证码 换一张
取 消