I am spending some time exploring C#, I found a tutorial online to create a login form and it is all good enough, but when I execute the code, the result is messed up.
Can you help?
This is the design of my form:
This is the code behind:
public partial class Form_LogIn : Form
{
public Form_LogIn()
{
InitializeComponent();
}
private void BtLogin_Click(object sender, EventArgs e)
{
if (TxtUserName.Text == "My_User" && TxtPassword.Text == "My_Password")
{
new FormStart().Show();
this.Hide();
}
else
{
MessageBox.Show("User Name or password incorrect, please verify.");
TxtUserName.Clear();
TxtPassword.Clear();
TxtUserName.Focus();
}
}
private void LblCleanFields_Click(object sender, EventArgs e)
{
TxtUserName.Clear();
TxtPassword.Clear();
}
private void LblExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
This is the result of my execution:
Can you point a direction?
3