+ Reply to Thread
Results 1 to 7 of 7

Thread: A simple Log In screen

  1. #1
    Clawbo is offline Newbie
    Join Date
    Apr 2009
    Posts
    7
    Rep Power
    0

    Exclamation A simple Log In screen

    Hey, I don't know if this already exists, but here it is anyway.

    First off, add two labels, two text boxes, and one button. Place them as you want, and make one label say "Username:" and the other one "Password:"
    Make the button say "Log In".
    Here's what I did (remove the space after the first h):

    h ttp://i39.tinypic.com/j6h1mf.jpg

    Now, Double click the button, and insert this code:

    Code:
            Dim usrValid As Integer
            Dim pswdValid As Integer
    
            usrValid = False
            pswdValid = False
    
            If TextBox1.Text = "(Your username here)" Then usrValid = True
            If TextBox2.Text = "(Your pass here)" Then pswdValid = True
    
            If usrValid = True And pswdValid = True Then (name of your form).Show()
    
            Me.Close()
    And that's it! Hope it Helps!

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Jordan Guest

    Re: A simple Log In screen

    Interesting bit of code. What if you wanted to have multiple users and passwords or allow users to add/change users and passwords?

  4. #3
    Clawbo is offline Newbie
    Join Date
    Apr 2009
    Posts
    7
    Rep Power
    0

    Re: A simple Log In screen

    I would added an "Or" in the "If" bit.

  5. #4
    Join Date
    Mar 2008
    Posts
    7,145
    Rep Power
    86

    Re: A simple Log In screen

    What if you have 300 users though?

  6. #5
    Clawbo is offline Newbie
    Join Date
    Apr 2009
    Posts
    7
    Rep Power
    0

    Re: A simple Log In screen

    Guys, I'm new. I don't know

  7. #6
    Join Date
    Mar 2008
    Posts
    7,145
    Rep Power
    86

    Re: A simple Log In screen

    Just pointing out that it's not very practical.

    Although you got the basics of how log in forms should work which a great start.

    One thing that I want to point out, you should name your controls better. When I look at the name of a control, I should be able to pick out this information:
    • The type of control (e.g. radio button, text box, etc)
    • The type of information inputted using that control.

    So instead of TextField1 for the user name a better name would be: txtUsername

    I can pick out that it's a text field and is used for inputting a user name.

    It also makes your code easier to understand.

  8. #7
    Clawbo is offline Newbie
    Join Date
    Apr 2009
    Posts
    7
    Rep Power
    0

    Re: A simple Log In screen

    Thanks guys, I'll be sure to do that.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 10-13-2011, 08:52 PM
  2. I'm stumped by this simple, simple code...
    By scottbomb in forum Java Help
    Replies: 6
    Last Post: 03-10-2011, 08:35 PM
  3. Screen resolution issue and getting rid of gaps around the edges of the screen...
    By HumansAreFriendsNotFood in forum HTML Programming
    Replies: 10
    Last Post: 06-07-2010, 11:07 AM
  4. simple log-in screen?
    By martybell in forum Visual Basic Programming
    Replies: 10
    Last Post: 01-05-2009, 02:22 AM
  5. 16 " screen
    By techni68 in forum Computer Hardware
    Replies: 5
    Last Post: 01-22-2007, 08:43 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts