global logininformation
-
Hi, i have an application with my own Login-System. When a user starts the app and loggs correct in,i want to store user-data in a class "Logininformation". i have to access the Logininformation class in many other forms. How could this be done ? I know that global Vars are not allowed in C#, but how can i get this problem done ? bye jogi
-
Hi, i have an application with my own Login-System. When a user starts the app and loggs correct in,i want to store user-data in a class "Logininformation". i have to access the Logininformation class in many other forms. How could this be done ? I know that global Vars are not allowed in C#, but how can i get this problem done ? bye jogi
There are many ways to do it. You could persist the information, such in a database. You could also pass the information between forms (least favorable), or have a singleton object that is shared between the forms.
only two letters away from being an asset
-
Hi, i have an application with my own Login-System. When a user starts the app and loggs correct in,i want to store user-data in a class "Logininformation". i have to access the Logininformation class in many other forms. How could this be done ? I know that global Vars are not allowed in C#, but how can i get this problem done ? bye jogi
You can simply define the class as
static
. For example:internal static class Logininformation {
private static string username;
...
internal static string UserName {
get {
return username;
}
set {
username = value;
}
}
...The need to optimize rises from a bad design.My articles[^]