So I've been following a YouTube tutorial on how to recreate a school attendance/login system using C# and MySQL for Visual Studio, and when I try logging in with or without typing anything in the text boxes, I keep getting the error in the title. Here's my code within the main form:
private void MainForm_Load(object sender, EventArgs e)
{
//the code in MainForm_Activated was originally placed here but it gave the same error, so it was corrected
}
private void MainForm_Activated(object sender, EventArgs e)
{
//opens LoginForm alongside MainForm
LoginForm newLogin = new LoginForm();
newLogin.ShowDialog();
//closes LoginForm if the username and password are incorrect
if (newLogin.loginFlag == false)
{
Close();
}
}
}
}
In the tutorial, I noticed that MainForm_Activated just seemed to appear in the Properties window under "Activated", whereas I had to type it into the same box from scratch. The picture is here.
Here's the tutorial itself, the error is shown at 13:06: https://www.youtube.com/watch?v=Ck3cKCGevlM