I'm new to C# and Winforms.
I have been trying to pass the username variable from form 1 to be used in form 3 and it is not working. I have been searching forever for a solution and I am confused as to why it is not working. In the label, nothing is showing up except for the string. Any help is appreciated!
FORM 1:
public static string username;
private void btn_login_Click(object sender, EventArgs e)
{
if (successfulLogin == true)
{
username = tb_username.Text;
Form3 form = new Form3();
form.Show();
this.Hide();
}
else
{
MessageBox.Show("Log in unsuccessful. Please make sure your credentials are correct or sign up");
tb_password.Clear();
tb_username.Clear();
tb_username.Select();
}
}
FORM3:
public Form3()
{
InitializeComponent();
usernameChange();
}
private void usernameChange()
{
label1.Text = Form1.username + ", please create, review or manage your flashcards below";
}