CodePudding user response:
Build an empty form, don't pull the control stick code in running line
Private WithEvents Num0 As Label
Private WithEvents Num1 As Label
Private WithEvents Num2 As Label
Private WithEvents Num3 As Label
Private WithEvents Num4 As Label
Private WithEvents Num5 As Label
Private WithEvents Num6 As Label
Private WithEvents Num7 As Label
Private WithEvents Num8 As Label
Private WithEvents Num9 As Label
Private WithEvents Cancel As Label
Private WithEvents Enter As Label
Private WithEvents PassBox As TextBox
Private WithEvents Back As Label
Private Sub Form_Load ()
Dim (S) As Label
Dim As Integer I
ReDim S (12)
For I=0 To UBound (S)
The Set S (I)=Me. Controls. Add (" VB. The Label ", "Label_" & amp; I)
S (I). Move 60 + (I Mod 4) * 420, 480 + (I/4) * 420, 360, 360
S (I). The Appearance=0
S (I). The BorderStyle=1
S (I). Alignment=2
S (I). The Caption=CStr (I)
S (I) FontSize=14
S (I). The Visible=True
Next
S (10). Move 900, 1315, 780, 360
S (10). BackColor=vbYellow
S (10). The Caption="Back"
S (10) FontSize=12
S (11). Move up to 60, 1720, 780, 360
S (11). BackColor=vbRed
S (11). The Caption="Cancel"
S (11) FontSize=12
S (12). Move 900, 1720, 780, 360
S (12). BackColor=vbGreen
S (12). The Caption="Enter"
S (12) FontSize=12
The Set Num0=S (0)
The Set Num1=S (1)
The Set Num2=S (2)
The Set of Num3=S (3)
The Set Num4=S (4)
The Set Num5=S (5)
The Set Num6=S (6)
The Set Num7=S (7)
The Set Num8=S (8)
The Set Num9=S (9)
The Set Back=S (10)
Set the Cancel=S (11)
Set the Enter=S (12)
The Set PassBox=Me. Controls. The Add (" VB. The TextBox ", "PassBox_0")
PassBox. Move 60, 60, 1620, 360,
PassBox. Appearance=0
PassBox. BorderStyle=1
PassBox. BackColor=vbBlack
PassBox. ForeColor=vbGreen
PassBox. FontSize=16
PassBox. PasswordChar="*"
PassBox. Visible=True
PassBox. Enabled=False
End Sub
Private Sub Num0_Click ()
PassBox. Text=PassBox. Text & amp; Num0. Caption
End Sub
Private Sub Num1_Click ()
PassBox. Text=PassBox. Text & amp; Num1. Caption
End Sub
Private Sub Num2_Click ()
PassBox. Text=PassBox. Text & amp; Num2. Caption
End Sub
Private Sub Num3_Click ()
PassBox. Text=PassBox. Text & amp; Num3. Caption
End Sub
Private Sub Num4_Click ()
PassBox. Text=PassBox. Text & amp; Num4. Caption
End Sub
Private Sub Num5_Click ()
PassBox. Text=PassBox. Text & amp; Num5. Caption
End Sub
Private Sub Num6_Click ()
PassBox. Text=PassBox. Text & amp; Num6. Caption
End Sub
Private Sub Num7_Click ()
PassBox. Text=PassBox. Text & amp; Num7. Caption
End Sub
Private Sub Num8_Click ()
PassBox. Text=PassBox. Text & amp; Num8. Caption
End Sub
Private Sub Num9_Click ()
PassBox. Text=PassBox. Text & amp; Num9. Caption
End Sub
Private Sub Back_Click ()
PassBox. Text=Left (PassBox. Text, Len (PassBox. Text) - 1)
End Sub
Private Sub Cancel_Click ()
PassBox. Text=""
End Sub
Private Sub Enter_Click ()
MsgBox "password results=" & amp; PassBox. Text, vbInformation + vbOKOnly, "password"
End Sub
CodePudding user response: