[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
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:
Dim username(2) As String
Dim password(2) As String
Dim login As Boolean
username(0) = "admin"
username(1) = "guest"
username(2) = "other"
password(0) = "password1"
password(1) = "password2"
password(2) = "password3"
login = False
For i = 0 To 2
If (TextBox7.Text = username(i)) And (TextBox8.Text = password(i)) Then
login = True
End If
Next
If (login) Then
MsgBox("PASSED")
Else
MsgBox("FAILED")
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.
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?
Re: Can you help with login forms
While on the login form do
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".
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
Re: Can you help with login forms
thank you guys for your help
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