Edit the text of labels and label them as �Username� and �Password�. The command buttons should be �Login� and �Cancel�.
Now it depends on you how much users you want to allow to access your application. The list can go-on but as this is a simple login form, you should not go such long with it. The code is simple, but a little tricky. What you need to do is just program the �if� statement in such a way that it checks for the number of usernames and password you entered.
You can add additional features to your application, such as an MsgBox that would show the status, that a login is successful or not. So just have a look on codes for the command button:
For Login Command Button:
Dim user As String
user = TextBox1.Text
Dim pass As String
pass = TextBox2.Text
If user = "user1" And pass = "pass1" Or user = "user2" And pass = "pass2" Then
MsgBox("Login successful")
Me.Hide()
Form2.Show()
Else : MsgBox("Login Unsuccessful. Please try again.")
End If
For cancel button:
Me.Close()
Now test your program, that should be perfect. In the above code you can replace �user1� and �user2� with different usernames and �pass1� and �pass2� with different passwords and you can add more usernames and passwords with �or� command. If you didn�t understand, click here to download the source code.
Happy Coding!
Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com
atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :