Results 1 to 7 of 7

Thread: [RESOLVED] Can you help with login forms

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Location
    wisconsin
    Posts
    6

    Resolved [RESOLVED] Can you help with login forms

    okay well i'm just messing around with visual basic 2008 and im not that good at it and i want to make something that uses a login form but its not meant to be online so how do i go about that i'll show you what i got so far.
    Code:
    Dim Passwords As String
        Dim Usernames As String
    
        Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
            Passwords = "login" Or "1234" Or "Login"
            Usernames = "Admin" Or "Guest"
            If Passwords And Usernames = False Then Close() Else Form1.Show()
    
        End Sub
    Last edited by skeletonchoji; Jul 12th, 2010 at 05:26 PM.

  2. #2
    Member
    Join Date
    Jun 2010
    Posts
    55

    Re: Can you help with login forms

    This isnt a good way to be doing it but it's upto you which path you choose. A solutions below.

    vb Code:
    1. Dim username(2) As String
    2.         Dim password(2) As String
    3.         Dim login As Boolean
    4.  
    5.         username(0) = "admin"
    6.         username(1) = "guest"
    7.         username(2) = "other"
    8.  
    9.         password(0) = "password1"
    10.         password(1) = "password2"
    11.         password(2) = "password3"
    12.  
    13.         login = False
    14.  
    15.         For i = 0 To 2
    16.             If (TextBox7.Text = username(i)) And (TextBox8.Text = password(i)) Then
    17.                 login = True
    18.             End If
    19.         Next
    20.  
    21.         If (login) Then
    22.             MsgBox("PASSED")
    23.         Else
    24.             MsgBox("FAILED")
    25.         End If

    A better way would be to look into using a database.

    This is a good tutorial

    http://www.codeguru.com/vb/gen/vb_da...cle.php/c15033

    This is a solution.

    http://www.daniweb.com/forums/thread23574.html

    Hoep this helps.

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Location
    wisconsin
    Posts
    6

    Re: Can you help with login forms

    Well thanks i got it too work do you know how i can close the login form with out closing the whole program?

  4. #4
    Member
    Join Date
    Jun 2010
    Posts
    55

    Re: Can you help with login forms

    While on the login form do

    vb Code:
    1. Me.Close()

    If this close the whole program you need to go into the project settings. There will be something like "exit when startup form closes". You need to change it to "exit when last form closes".

  5. #5
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Can you help with login forms

    Hello,

    You might want to take a look at the CodeBank Submission here:

    http://www.vbforums.com/showthread.php?t=499888

    Here is another approach as well:

    http://www.vbforums.com/showthread.php?t=549128

    Hope that helps!!

    Gary

  6. #6

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Location
    wisconsin
    Posts
    6

    Re: Can you help with login forms

    thank you guys for your help

  7. #7
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Can you help with login forms

    Hey,

    Have you got the answer that you were looking for?

    If so, can you remember to mark your thread as resolved?

    Thanks

    Gary

Tags for this Thread

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