1. buat 1 shape, 1 text box , 3 command button, 2 label
2. kemudian tambahkan juga timer dengan properties;
Name : Timer1
Interval : 1000
Enabled : True
3. atur sedemikian rupa sehigga seperti ini ;
atau bisa sesuai kreatif anda
4. kemudian klik view code dan tambahkan
Option Explicit
Private Sub Command1_click()
If Text1.Text = "" Then
MsgBox "Masukkan Nilainya Dulu"
Timer1.Enabled = False
Text1.SetFocus
Else
Timer1.Enabled = True
Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = True
End If
End Sub
Private Sub Command2_click()
Timer1.Enabled = False
If Text1 = Label1 Then
MsgBox "congularation"
Command2.Enabled = False
Else
MsgBox "Anda Belum Beruntung"
Command2.Enabled = False
End If
End Sub
Private Sub Command3_click()
Label2.Caption = "XXX"
Text1.Text = ""
Text1.SetFocus
Command1.Enabled = True
End Sub
Private Sub Form_Load()
Command2.Enabled = False
End Sub
Private Sub Text1_keypress(Keyascii As Integer)
If Not IsNumeric(Chr(Keyascii)) Then
Keyascii = 0
MsgBox "yang anda masukkan bukan angka!"
End If
If Len(Text1) > 2 Then Keyascii = 0
End Sub
Private Sub Timer1_timer()
Dim a As Integer
a = Int(Rnd * 999)
Label2.Caption = a
End Sub
5. kemudian klik start
jika anda capek ni download aja yang udah jadi di Sini
Atau di Sini
0 komentar:
Posting Komentar
Silahkan komentarnya