Dim numero As Integer, num As Integer, max As Integer
Dim numtentativi As Integer, cont As Integer
Dim flag As Boolean, flag2 As Boolean
Dim suoni As Boolean
Private Sub Check1_Click()
suono.FileName = App.Path & "\sound560.wav"
If Check1.Value = 1 Then
flag = True
Text1.MaxLength = 4
Check2.Value = 0
Label4.Caption = "Max 1000"
max = 1000
numero = Int(Rnd * max)
Else
flag = False
Text1.MaxLength = 3
max = 100
numero = Int(Rnd * max)
Label4.Caption = "Max 100"
End If
End Sub
Private Sub Check2_Click()
suono.FileName = App.Path & "\sound560.wav"
If Check2.Value = 1 Then
flag2 = True
Text1.MaxLength = 4
Check1.Value = 0
Label4.Caption = "Max 2000"
max = 2000
numero = Int(Rnd * max)
Else
flag2 = False
Text1.MaxLength = 3
Label4.Caption = "Max 100"
max = 100
numero = Int(Rnd * max)
End If
End Sub
Private Sub cmdvedi_Click()
Check1.Enabled = False
Check2.Enabled = False
If Text1.Text <> "" Then
If IsNumeric(Text1.Text) = True Then
suono.FileName = App.Path & "\bossfire.wav"
numero2 = Val(Text1.Text)
Else
Text1.Text = ""
End If
If numero2 > numero Then
Label2.Caption = "Il numero è più piccolo"
cont = numtentativi - 1
Label3.Caption = cont
numtentativi = numtentativi - 1
Else
Label2.Caption = "Il numero è più grande"
cont = numtentativi - 1
Label3.Caption = cont
numtentativi = numtentativi - 1
If numero = numero2 Then
suono.FileName = App.Path & "\vittoria.wav"
Label2.Caption = "Complimenti hai indovinato"
Label3.Visible = False
cmdvedi.Enabled = False
End If
End If
Else
suono.FileName = App.Path & "\fuel.wav"
End If
If numtentativi = 0 Then
If numero <> numero2 Then
Option1.Enabled = False
Option2.Enabled = False
Option3.Enabled = False
Option4.Enabled = False
Option5.Enabled = False
Label2.Caption = "Hai finito le possibilità il numero è " & numero
Label3.Caption = ""
Label3.Visible = False
Text1.Text = ""
numero = Int(Rnd * max)
cmdvedi.Enabled = False
numtentativi = num
Else
Label2.Caption = "Complimenti hai indovinato"
Label3.Visible = False
cmdvedi.Enabled = False
End If
End If
End Sub
Private Sub Form_Load()
suono.FileName = App.Path & "\inizio.wav"
cont = 0
Randomize
numero = Int(Rnd * 100)
numtentativi = 3
Label3.Caption = "3"
suoni = False
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If MsgBox("Sei sicuro di voler uscire?", vbQuestion + vbYesNo, "Esci") = vbYes Then
MsgBox "BY ALBERT KING!!!", vbInformation, "CREATORE"
End
Else
Cancel = True
End If
End Sub
Private Sub mnuesci_Click()
Dim ris As Integer
ris = MsgBox("Sei sicuro di voler uscire?", vbYesNo, "Esci")
If ris = vbYes Then
MsgBox "By Albert King!!!", vbInformation, "creatore"
End
End If
End Sub
Private Sub mnupartita_Click()
suono.FileName = App.Path & "\inizio.wav"
Label3.Visible = True
Label5.Visible = True
cmdvedi.Enabled = False
Label3.Caption = ""
Label2.Caption = ""
Text1.Text = ""
Option1.Enabled = True
Option2.Enabled = True
Option3.Enabled = True
Option4.Enabled = True
Option5.Enabled = True
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = False
Option5.Value = False
Check1.Enabled = True
Check2.Enabled = True
Check1.Value = 0
Check2.Value = 0
numero = Int(Rnd * 100)
End Sub
Private Sub Option1_Click()
suono.FileName = App.Path & "\alarm1.wav"
If Option1.Value = True Then
cmdvedi.Enabled = True
numtentativi = 3
num = 3
Label3.Caption = "3"
End If
End Sub
Private Sub Option2_Click()
suono.FileName = App.Path & "\alarm1.wav"
If Option2.Value = True Then
cmdvedi.Enabled = True
numtentativi = 4
num = 4
Label3.Caption = 4
End If
End Sub
Private Sub Option3_Click()
suono.FileName = App.Path & "\alarm1.wav"
If Option3.Value = True Then
cmdvedi.Enabled = True
numtentativi = 5
num = 5
Label3.Caption = 5
End If
End Sub
Private Sub Option4_Click()
suono.FileName = App.Path & "\alarm1.wav"
If Option4.Value = True Then
cmdvedi.Enabled = True
numtentativi = 6
num = 6
Label3.Caption = 6
End If
End Sub
Private Sub Option5_Click()
suono.FileName = App.Path & "\alarm1.wav"
If Option5.Value = True Then
cmdvedi.Enabled = True
numtentativi = 7
num = 7
Label3.Caption = 7
End If
End Sub
Private Sub Text1_Change()
If Not IsNumeric(Text1.Text) Then
Text1.Text = ""
End If
If flag = False And flag2 = False Then
If Val(Text1.Text) < 0 Or Val(Text1.Text) > 100 Then
Text1.Text = ""
MsgBox "Non ti capisi niente!!!", vbInformation, "Semo"
End If
End If
If Label4.Caption = "Max 1000" Then
If Val(Text1.Text) < 0 Or Val(Text1.Text) > 1000 Then
Text1.Text = ""
MsgBox "Non ti capisi niente!!!", vbInformation, "Semo"
End If
End If
If Label4.Caption = "Max 2000" Then
If Val(Text1.Text) < 0 Or Val(Text1.Text) > 2000 Then
Text1.Text = ""
MsgBox "Non ti capisi niente!!!", vbInformation, "Semo"
End If
End If
End Sub