Lucas7yoshi Lucas7yoshi - 1 year ago 92 Question

Check if statement, not case sensitive

I want to create a fake run box to use against Technical Support Scammers to waste their time. I want to have some specified text run a msgbox. Is there a way to accept all cases? (notepad, NoTePaD, NOTEPAD etc.).

If textbox1.text = "Notepad" Then
Msgbox("Unable to open")

Answer Source

I'm a bit confused as to what "all versions of it" means, however the following will ignore spaces and capitalization:

Dim str As String = textbox1.text.ToLower().Replace(" ", "")
If str = "notepad" Then MsgBox("Unable to open")

This is a VB.Net solution, however as Plutonix mentioned in the comments, it's hard to tell what sort of solution you're looking for - you've tagged two different types of VB.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download