how to case select with case-insensitive string ?

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.
 
S

Steve C. Orr [MVP, MCSD]

Try this syntax:

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

Case "bye"

End Select
 
K

Ken Tucker [MVP]

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
-------------
 
H

Herfried K. Wagner [MVP]

* "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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top