|
-
Jan 14th, 2005, 06:34 PM
#1
Thread Starter
Member
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
Click Here to see my website!!!
-
Jan 14th, 2005, 06:43 PM
#2
Re: Make VB not case sensitive
Code:
If StrComp(txtPassword.Text, "Woof And The Badger", vbBinaryCompare) = 0 Then
MsgBox "Password Correct."
End If
Woof
-
Jan 14th, 2005, 06:46 PM
#3
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
-
Jan 14th, 2005, 07:08 PM
#4
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.
-
Jan 14th, 2005, 07:25 PM
#5
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. 
Once you do this, VB will perform case-insensitive comparisons.
so, "abc" = "ABC" = True
Last edited by pnish; Jan 14th, 2005 at 07:29 PM.
Pete
No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.
-
Jan 14th, 2005, 07:44 PM
#6
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
-
Jan 14th, 2005, 08:00 PM
#7
Re: Make VB not case sensitive
 Originally Posted by Wokawidget
Errr...yea, but that would ALL text comparisons would be done like that in the form.
 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.
Pete
No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|