Hopefully, someone can help with this problem. I have a login form and I want to the let the user know that the application is processing his/her request once the submit button clicked. The problem is that I am setting the labe1.TEXT = "";
and the pictureBox2.Visible = false;
when the form starts but I cannot get the program to set it back to label.Text = "processing";
and pictureBox2.Visible = true;
when the user clicks the submit button.
private void btnLogin_Click_1(object sender, EventArgs e)
{
AppDomain.CurrentDomain.SetData("DataDirectory", Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\store_close_localdb.mdf;Integrated Security=True;Connect Timeout=30");
SqlDataAdapter sda = new SqlDataAdapter("Select Role from tblLogin where Username='" + tbUsername.Text + "' and Password='" + tbPassword.Text + "' ", con);
DataTable dt = new DataTable();
sda.Fill(dt);
if (dt.Rows.Count == 1)
{
label2.Text ="Processing your login request, please wait...";
pictureBox2.Visible = true;
Application.DoEvents();
pleasewait pw = new pleasewait();
pw.Show();
}
else
{
label1.Text = "INCORRECT USERNAME OR PASSWORD :(";
}
}