by chubzyko on Fri Sep 26, 2008 12:50 am
well, there are many ways on how you can do it.
here's a simple one that I had just created in vb6.
you need 1 txtbox there, 7 command buttons. the last command button is for the log in and you need 2 forms. just copy the code below.
- Code: Select all
Option Explicit
Dim a As String
Dim b As String
Dim c As String
Dim d As String
Dim e As String
Dim f As String
Private Sub Command1_Click()
a = 1
Text1.Text = Text1.Text + a
End Sub
Private Sub Command2_Click()
b = 2
Text1.Text = Text1.Text + b
End Sub
Private Sub Command3_Click()
c = 3
Text1.Text = Text1.Text + c
End Sub
Private Sub Command4_Click()
d = 4
Text1.Text = Text1.Text + d
End Sub
Private Sub Command5_Click()
e = 5
Text1.Text = Text1.Text + e
End Sub
Private Sub Command6_Click()
f = 6
Text1.Text = Text1.Text + f
End Sub
Private Sub Command7_Click()
If Text1.Text = 654321 Then
'your code goes here, ex:
Form1.Hide
Form2.Show
Else
Text1.Text = ""
MsgBox "Access Denied"
End If
End Sub
Private Sub Form_Load()
Text1.Text = ""
Command1.Caption = 1
Command2.Caption = 2
Command3.Caption = 3
Command4.Caption = 4
Command5.Caption = 5
Command6.Caption = 6
Command7.Caption = "LOGIN"
Text1.Locked = True
End Sub
Private Sub Text1_Change()
Text1.MaxLength = 7
If Len(Trim(Text1.Text)) > 6 Then
MsgBox "You have reach the maximum digit to enter"
End If
End Sub
"Failure is the key to success, so try and try until you succeed."