Make VB not case sensitive
Hello, I am trying to write a program I wanted to know if I disable the case sensitive? I don't know if it is necessary in this instance but I would like to know anyhow, the program I am trying to make is just a very simple program to password protect msconfig, does anyone see any improvements I could make?
This is the code I am using
VB Code:
Private Sub Command1_Click()
If Text1.Text = "abcdefg" Then
Shell "C:\WINDOWS\PCHealth\HelpCtr\Binaries\msconfig.exe", vbNormalFocus
End
Else
MsgBox "You Have Entered A Wrong Password", vbOKOnly, "Incorrect Password"
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Label1.Caption = App.Path + "\" + App.EXEName + ".exe"
If Label1.Caption <> "C:\WINDOWS\msconfig.exe" Then
FileCopy Label1.Caption, "c:\windows\msconfig.exe"
MsgBox "This File Has Been Copied To You Windows Directory And Will Now Close, Please delete this file, msconfig is now password protected!", vbOKOnly, "Read This!!!"
End
End If
Label1.Enabled = False
End Sub
Re: Make VB not case sensitive
Code:
If StrComp(txtPassword.Text, "Woof And The Badger", vbBinaryCompare) = 0 Then
MsgBox "Password Correct."
End If
Woof
Re: Make VB not case sensitive
The above makes it CASE SENSETIVE, the following removes case.
Code:
If StrComp(txtPassword.Text, "Woof And The Badger", vbTextCompare) = 0 Then
MsgBox "Password Correct."
End If
Or you could have done:
Code:
If LCase$(txtPassword.Text)="woof and the badger" Then
MsgBox "Password Correct."
End If
Many different ways.
Woof
Re: Make VB not case sensitive
I wouldn't delete the file, just rename it to something else, and then call that from your program. If it doesn't have an .exe extension, then it won't run. Don't know if it wil run with shell without the extension. You may want to try it out.
Re: Make VB not case sensitive
The easiest way is to put Option Compare Text in the general declarations section of any forms or modules where you want this functionality. :thumb:
Once you do this, VB will perform case-insensitive comparisons.
so, "abc" = "ABC" = True
Re: Make VB not case sensitive
Errr...yea, but that would ALL text comparisons would be done like that in the form.
I wouldn't use it, but I suppose that's down to personal choice.
WOka
Re: Make VB not case sensitive
Quote:
Originally Posted by Wokawidget
Errr...yea, but that would ALL text comparisons would be done like that in the form.
Quote:
Originally Posted by zachdoty
I am trying to write a program I wanted to know if I disable the case sensitive?
Just giving him what he asked for. :)