Results 1 to 3 of 3

Thread: password protecting forms?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2004
    Posts
    27

    password protecting forms?

    Hello,

    I would like to password protect my program!!

    i have a introduction form and i would like to put a password on this, so that when the password is entered the form and programe becomes enabled.

    i only want a basic password, nothing fancy!!!

    Regards

    Homer S

  2. #2
    Hyperactive Member
    Join Date
    Apr 2003
    Location
    Three Rivers, MI
    Posts
    354
    Nothing fancy. Well this is a really simple example of doing it. I have the two buttons with their enabled property set to false at run time. When the correct username and password are entered I just enable the buttons in my code. It works for what I am doing so I hope it is relevant to what you are looking for. If not I am sure someone will offer a better alternative soon.
    VB Code:
    1. Private Sub btnSubmitCredentials_Click( _
    2.         ByVal sender As System.Object, _
    3.         ByVal e As System.EventArgs) _
    4.         Handles btnSubmitCredentials.Click
    5.  
    6.         Dim strUN As String = txtUserName.Text
    7.         Dim strPW As String = txtPassWord.Text
    8.         If strUN = "Admin" And strPW = "pass" Then
    9.             btnClearTB.Enabled = True
    10.             btnUpdateRates.Enabled = True
    11.         Else
    12.             MsgBox("User not authenticated", _
    13.                 MsgBoxStyle.OKOnly, "Authentication Error")
    14.             txtUserName.Clear()
    15.             txtPassWord.Clear()
    16.             txtUserName.Focus()
    17.         End If
    18.  
    19.     End Sub
    All you need to do is modify it to work in your case, which I assume is opening the next form.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2004
    Posts
    27
    Thank you very much, i will give it ago!


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