c# - Create new user and comparison for two textbox -
i have form new user in project. not know wrong it.
this method:
private void newusermethod() {     try {         newusertbl newusertbl = new newusertbl();         newusertbl.fname = txtfname.text;         newusertbl.lname = txtlname.text;         newusertbl.username = txtusername.text;         newusertbl.newpassword = txtpass.text;         newusertbl.confirmpassword = txtagainpass.text;         txtfname.text = "";         txtlname.text = "";         txtusername.text = "";         txtpass.text = "";         txtagainpass.text = "";          if (txtpass == txtagainpass) {             db_admin.newusertbls.insertonsubmit(newusertbl);             db_admin.submitchanges();             messagebox.show("new user created");         } else {              messagebox.show("wrong password");         }      } catch (exception)      {          messagebox.show("you entered wrong data");     } }   i'm new @ c# programming.
you comparing 2 controls instead of text property
if (txtpass == txtagainpass) {  }   however if start comparing it's text property
like
if (txtpass.text == txtagainpass.text) {  }   this won't bring change because making empty
txtpass.text = ""; txtagainpass.text = "";   try this
if (newusertbl.newpassword  == newusertbl.confirmpassword) {  }      
Comments
Post a Comment