Reputation: 2105
I am using windows form application using C#. I am having two password textboxes (Enter password and Verify password) I have to enter the password and click on Ok button. In asp.net, we had soemthing like compare validator that will check whether both the textboxes have same content or not. How can I achieve the same using winforms? When I click Ok button, I am having a mechanism to check the DB if correct password is entered. But, I want to perform compare validate before I click Ok button. Any idea ?
Upvotes: 0
Views: 1648
Reputation: 5715
There is no out-of-box feature like Validator control in ASP.NET but you can try ValidationProvider Controls even it's based on .NET 1.1 but it can use with .NET 4.0
Upvotes: 0
Reputation: 392
Is there some reason you can't just compare the two passwords before checking against the DB? (Sorry, I don't have comment privileges yet so I had to post as answer.)
Upvotes: 0
Reputation: 225054
Just compare them with ==
:
if(passwordBox.Text == verifyPasswordBox.Text) {
// It matches
} else {
// It doesn't.
}
Upvotes: 1