how to case select with case-insensitive string ?

  • Thread starter Thread starter Tee
  • Start date Start date
T

Tee

Hi,

How to case select with case-insensitive ?

eg:

Select Case Textbox1.Text
Case "Hello" -- ( this will include "Hello", "HELLO", "hElLo" etc etc. )

Case "Bye"

End Select

anyone know how ?


Thanks.
 
Try this syntax:

Select Case Textbox1.Text.ToLower()
Case "hello"

Case "bye"

End Select
 
Hi,

Add Option Compare Text to the top of your file. Simple console app
example.

Option Compare Text

Module Module1

Sub Main()
Dim strOne As String = "hello"
Dim strTwo As String = "HELLO"

Console.WriteLine(strOne = strTwo)
End Sub

End Module


Ken
-------------
 
* "Tee said:
How to case select with case-insensitive ?

eg:

Select Case Textbox1.Text
Case "Hello" -- ( this will include "Hello", "HELLO", "hElLo" etc etc. )

Case "Bye"

End Select

anyone know how ?

In the project properties, set "Option Compare" to "Text", or on
per-file basis you can add 'Option Compare Text' in the declaration area
of your file.
 
Back
Top