I recently stumbled upon this problem in one of our company .NET projects.
For some reason, project settings there were configured for Text comparison, rather than Binary.
As a result, lower case strings were equal to upper case, which was discovered later when some bug in UI occured.
There were three solutions available:
Switch default comparison type on the project level. Go to
Project / Properties / Option Compare -> Binary.
Set default comparison type on the document level. Put
Option Compare Textor
Option Compare Binaryon top of the code, where applicable.
String.Compare(strA As String, strB As String, ignoreCase As Boolean)on a per-use basis:
String.Compare(str1, str2, False) 'case sensitive String.Compare(str1, str2, True) 'case insensisitve
We went with (1), but for some cases (2) and (3) might be better, especially if you don’t want to break your existing code.