Question: i have this code that updates the login private void btnUpdate_Click(object sender, EventArgs e) { cIsLogin MyLogin = new cIsLogin(); MyLogin.UserId = txtUserID.Text; MyLogin.PSW =

i have this code that updates the login

private void btnUpdate_Click(object sender, EventArgs e) { cIsLogin MyLogin = new cIsLogin(); MyLogin.UserId = txtUserID.Text; MyLogin.PSW = txtPassword.Text;

MyLogin.CreateLogin(); if (MyLogin.CreateLogin() == true) { MessageBox.Show("Password Updated"); } else { MessageBox.Show("Error"); }

and this is what i have in the class

class cIsLogin { private string sUserId = ""; public string UserId { get { return sUserId; } set { sUserId = value; } } private string sPSW = ""; public string PSW { get { return sPSW; } set { sPSW = value; } } private string sResultMessage = ""; public string ResultMessage { get { return sResultMessage; } set { sResultMessage = value; } } private string pUserID = ""; public string UserID { get { return pUserID; } set { pUserID = value; }

} private string pPassword = ""; public string Password { get { return pPassword; } set { pPassword = value; } }

private bool SaveUserInfo() { try { string sFileName = Path.GetDirectoryName(Directory.GetCurrentDirectory()) + "\\" + sUserId + "sSecretLogingFileThatNoeOneWillEverFind"; string sFileText = sPSW; StreamWriter MyStreamWriter = new StreamWriter(sFileName); MyStreamWriter.Write(sFileText); MyStreamWriter.Close(); MyStreamWriter.Dispose(); return true; } catch (Exception ex) { sResultMessage = ex.Message; return false; } }

public bool CreateLogin() { try { if ((sUserId == "") || (sPSW == "")) { sResultMessage = "User Input Blank"; return false; } if (SaveUserInfo() == true) { return true; } else { return false; }

} catch (Exception ex) { sResultMessage = ex.Message; return false;

now i need to add something to verify it from the original form from a button called

private void btnVerify_Click(object sender, EventArgs e) { here is where i need to pass the values to the class and it can be the same class i used to update the password

}

on the class it needs to be able to read it and verify it is correct or incorrect and pass back true or false

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!