Results 1 to 7 of 7

Thread: Make VB not case sensitive

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2004
    Posts
    33

    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:
    1. Private Sub Command1_Click()
    2. If Text1.Text = "abcdefg" Then
    3. Shell "C:\WINDOWS\PCHealth\HelpCtr\Binaries\msconfig.exe", vbNormalFocus
    4. End
    5. Else
    6. MsgBox "You Have Entered A Wrong Password", vbOKOnly, "Incorrect Password"
    7. End If
    8. End Sub
    9.  
    10. Private Sub Command2_Click()
    11. End
    12. End Sub
    13.  
    14. Private Sub Form_Load()
    15. Label1.Caption = App.Path + "\" + App.EXEName + ".exe"
    16. If Label1.Caption <> "C:\WINDOWS\msconfig.exe" Then
    17. FileCopy Label1.Caption, "c:\windows\msconfig.exe"
    18. 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!!!"
    19. End
    20. End If
    21. Label1.Enabled = False
    22. End Sub
    Click Here to see my website!!!

  2. #2

  3. #3
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    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

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    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.

  5. #5
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918

    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.

  6. #6
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    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

  7. #7
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918

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



Click Here to Expand Forum to Full Width