andrewmanuja
Well-known member
- Joined
- May 30, 2019
- Messages
- 75
- Programming Experience
- Beginner
Hi All,
I got a small application and need to store the user's login details (ex - user name) into a static variable.
I created a class named, "UserData" and it looks like below;
public class UserData
{
public static string userName;
}
I need to access the "userName" variable from other window forms.
Using the below command to check the variable value of the "UserName", gave a blank answer.
MessageBox.Show(UserData.userName);
I am not so sure about the reason for the said issue, however, I am checking for a valid username and password combination and need to get the value for the "userName" variable upon the database validation.
Assume the question is clear and appreciate a lot if you could help me to resolve this issue.
Thank you.
Kind regards,
Andrew
I got a small application and need to store the user's login details (ex - user name) into a static variable.
I created a class named, "UserData" and it looks like below;
public class UserData
{
public static string userName;
}
I need to access the "userName" variable from other window forms.
Using the below command to check the variable value of the "UserName", gave a blank answer.
MessageBox.Show(UserData.userName);
I am not so sure about the reason for the said issue, however, I am checking for a valid username and password combination and need to get the value for the "userName" variable upon the database validation.
Assume the question is clear and appreciate a lot if you could help me to resolve this issue.
Thank you.
Kind regards,
Andrew