as I just started with C# I have some trouble to get started. I am trying to make a simple login system, and this is what I've got so far,
private void button1_Click(object sender, EventArgs e)
{
string username = "Admin";
string password = "root";
if (!string.IsNullOrEmpty(textBox1.Text) && (!string.IsNullOrEmpty(textBox2.Text)))
MessageBox.Show("Fields are not filled");
if (!string.IsNullOrEmpty(textBox1.Text))
MessageBox.Show("No Password inserted");
if (!string.IsNullOrEmpty(textBox2.Text))
MessageBox.Show("No username inserted");
if ((textBox1.Text == username) && (textBox2.Text == password))
MessageBox.Show("Login Succeed");
else
MessageBox.Show("Login failed");
}
When I type in Admin as username and root as password it gives me login succeed, when I do random Username & Password it gives me Login failed, that part works flawless. it's more about the "not inserted" and fields are not filled..
It simply does nothing :') keeps saying " login failed" any idea how to fix this?
Aucun commentaire:
Enregistrer un commentaire