How to compare two textbox values in windows forms?
-
Hi how to validate two textbox values. ex, there are two textboxes, password and confirm password.. I want to compare these two. we can use comparevalidator in ASP.net. how can we do in windows forms..? can any one send me code? thanks in advance? am using asp.net 2.0 and C#.. I have used errorProvider control. see the following code.. if (txtFirstName.Text.Trim().Length == 0) // working fine { errorProvider1.SetError(txtFirstName, "This Field Can not be empty."); } if (txtUnitID.Text.Trim().Length == 0) //working fine { errorProvider1.SetError(txtUnitID, "This Field Can not be empty."); } // not working if (txtPassword.Text.Trim() != txtConfirmPwd.Text.Trim()) // not working. { errorProvider1.SetError(txtConfirmPwd, "Password not matched."); } I have written this code in save button click event. ex, if pwd is not equal it not showing error message. wat is the problem..?
-
Hi how to validate two textbox values. ex, there are two textboxes, password and confirm password.. I want to compare these two. we can use comparevalidator in ASP.net. how can we do in windows forms..? can any one send me code? thanks in advance? am using asp.net 2.0 and C#.. I have used errorProvider control. see the following code.. if (txtFirstName.Text.Trim().Length == 0) // working fine { errorProvider1.SetError(txtFirstName, "This Field Can not be empty."); } if (txtUnitID.Text.Trim().Length == 0) //working fine { errorProvider1.SetError(txtUnitID, "This Field Can not be empty."); } // not working if (txtPassword.Text.Trim() != txtConfirmPwd.Text.Trim()) // not working. { errorProvider1.SetError(txtConfirmPwd, "Password not matched."); } I have written this code in save button click event. ex, if pwd is not equal it not showing error message. wat is the problem..?