Textbox lowercase and capitols

Started by Slasher, Mon 19/11/2012 09:21:43

Previous topic - Next topic

Slasher

I'm looking for a way to make a Textbox input accept both lowercase and capitols of the same word .

Can you help?

Thanks



Gilbert

#1
Depends on how you are going to recognise the strings.
For example, you can just set the caseSensitive flag to false when you use the String.CompareTo() function. You can even use String.UpperCase() or String.LowerCase() to convert the whole thing to a single case before doing comparisons.

If you are using the parser, well... AFAIK comparisons are always case insensitive.

Slasher

Hi Iceboty V7000a,

At the moment for the correct answer I have 'if' as Uppercase and 'else if' as Lowercase and it works, as well as an 'else' for anything other then correct answer.

cheers




Gilbert

Actually I don't quite get what you are after, but if you write this:
Code: AGS
if (tbBox.Text.CompareTo("meow")==0){ blah bla bla }

then it should work for entries like meow, MEOW and even Meow or mEoW.

Slasher

#4
Cheers Iceboty V7000a

I'll give that a whirl  (nod)

EDIT: Works a treat.

Cheers Iceboty V7000a

slasher



SMF spam blocked by CleanTalk