Create a class with a public static property. Then all classes can set and
get the value using the syntax className.propertyName.
Here's an example:
public class SessionData
{
private static string userID = "";
public static string UserID
{
get { return userID; }
set {userID = value; }
}
}
Now you can get the value by calling: SessionData.UserID = userID;
And read the value via: userID = SessionData.UserID;
Alternatively, you could build this into the form's definition by creating a
stateful base class form that encapsulates the state information:
public class StateForm : System.Windows.Forms.Form
{
private static string userID = "";
public static string UserID
{
get { return userID; }
set {userID = value; }
}
}
HTH;
Eric Cadwell
http://www.origincontrols.com