Posted 6 years ago
·
Author
Hi. I created a windows forms application with c# and I wanted to add a login. I created a login on a separate program and imported it to the main app but I couldnt figure out how to call the main app after my login successful.
I ended up with one solution and two forms and tried this code again but it still said i needed a using statement. I got tired after hours of trying and screwing up my app. I ended up having to recreate from scratch. This is actually something I'm going to donate to a non profit church group. Just a basic app they need but I want it to look nice.
Right now, I deleted the login and I want to know if anyone has any advice on how to go about adding it in.
Thank you.
private void btnLogin_Click(object sender, EventArgs e)
{
dsUsers.ReadXml(XMLlocation);
for (int i = 0; i < dsUsers.Tables["LoginUsers"].Rows.Count; i++)
{
USerID = dsUsers.Tables["LoginUsers"].Rows[i]["UserId"].ToString();
Password = dsUsers.Tables["LoginUsers"].Rows[i]["PAssword"].ToString();
if(txtBxUserID.Text == USerID && txtBxPassword.Text==Password)
{
LoginSuccess = true;
this.Hide();
}
}
if (LoginSuccess==true)
{
MessageBox.Show("Login Successful"); //I removed this here and wanted to add a line below this ro run new form1. I cant recall the code I typed now.
}
else
{
MessageBox.Show("Login Failed");
}
}
I ended up with one solution and two forms and tried this code again but it still said i needed a using statement. I got tired after hours of trying and screwing up my app. I ended up having to recreate from scratch. This is actually something I'm going to donate to a non profit church group. Just a basic app they need but I want it to look nice.
Right now, I deleted the login and I want to know if anyone has any advice on how to go about adding it in.
Thank you.