Visual basic 2012 IgnoreCase on if textbox.text = ""
ignore-case, vb.net, visual-studio-2010
Solution
I would not recommend upper-casing or lower-casing as others have suggested. That can cause issues in some cultures, particularly Turkish. Instead, use `String.Equals(String, StringComparison)`:
If COMMAND_TEXT.Text.Equals("command", StringComparison.CurrentCultureIgnoreCase)
You may want to use `InvariantCultureIgnoreCase` or `OrdinalIgnoreCase` - it depends on the context.
I'd also strongly advise you to avoid shouty names like `COMMAND_TEXT` and use more conventional names instead.
Problem
How do I ignore upper/lower case letters this is my code : ``` if COMMAND_TEXT.Text = "command" then CONSOLE.AppendText("command entered!" & Environment.NewLine) else CONSOLE.AppendText("Invalid command" & Environment.NewLine) end if ``` I am making a simple console but when I try to enter : Command it doesn't find anything but when I enter : command it just executes the code I want. Do I have to make every possible text?? Like this : ``` if COMMAND_TEXT.Text = "command" then CONSOLE.AppendText("command entered!" & Environment.NewLine) elseif COMMAND_TEXT.Text = "Command" then CONSOLE.AppendText("command entered!" & Environment.NewLine) elseif COMMAND_TEXT.Text = "COMMAND" then CONSOLE.AppendText("command entered!" & Environment.NewLine) else CONSOLE.AppendText("Invalid command" & Environment.NewLine) end if ``` Or is there an other easier way like in Java EqualsIgnoreCase