Hey

So i'm trying to create a pretty simple login for now...
When i click the Log On button i need it to ingnore the wheather the letters are uppercase or lowercase, in textbox1, how can i do that? :D

Kind Regards
-Jazerix

Recommended Answers

All 3 Replies

You can call TextBox1.Text.ToLower() or TextBox1.Text.ToUpper() so all characters are in lower or upper case.

as an addition to C#Jaap. if you want to then compare to another string (lets say username and password stored in database) and the char is not all upper/lower case use this:

string username = textbox1.text;
if (username.Equals("string from database", StringComparison.CurrentCultureIgnoreCase))
{
}

if you're using string in languages with special characters use InvariantCultureIgnoreCase

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.