Character Casing in a Password Textbox

benschol

Member
Joined
Jun 8, 2005
Messages
22
Programming Experience
Beginner
Please how I can to validate or determine the Character Casing in a Password Textbox in Vb.Net (NOT Asp.NET) when the Application compare the Text write by the User with the Password in a DataBase?

Thanks!
 
When using the "=" operator to compare strings, it depends on whether Option Compare is set to Binary or Text. If it is set to Binary, using "=" performs a case-sensitive comparison. If it is set to Text, "=" performs a case-insensitive comparison.

You can use String.Compare to perform either type of comparison regardless of the value of Option Compare. String.Compare(string1, string2, True) will perform a case-insensitive comparison and return zero if the two strings match, e.g.

String.Compare("HELLO", "hello", True)

would return zero. Change the third argument to False to perform a case-sensitive comparison. Do a help search on "string.compare" for the details of all overloads.
 
kulrom said:
well that will return only 1, 0, -1 ... but what if you want to check where the difference is? What are the letters that don't match that from DB?

Cheers ;)
Quite true, but I thought we were validating a password here. Generally a password is simply valid or not, without regard for where the differences are.
 
Thanks very much to both Moderators for the fast and good replies!! Now I have a very clear idea about the problem and solution. Regards!!
 
Back
Top