Public Class Form1
Dim intentosfallidos, aciertos As Integer
Dim Random As New Random()
Dim hora As Integer = 0
Dim minuto As Integer = 0
Dim segundo As Integer = 0
Dim milisegundo As Integer = 0
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If Not Char.IsDigit(e.KeyChar) And Asc(e.KeyChar) <> 8 Then
e.Handled = True
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If (Val(Label1.Text) * Val(Label6.Text) = Val(TextBox1.Text)) Then
MsgBox("Muy bien")
Me.TextBox1.Text = ""
TextBox1.Focus()
aciertos = aciertos + 1
TextBox3.Text = aciertos
Dim op2 As Integer = Random.Next(2, 10)
Label6.Text = op2
Static Dim iImage2 As Integer
Select Case iImage2
Case 0
PictureBox1.Visible = True
PictureBox1.Image = System.Drawing.Image.FromFile("C:UsersJessica.JorgeA1DocumentsVisual Studio 2005ProjectsWindowsApplication1WindowsApplication1PICTURESonionhead011_thumb.gif")
iImage2 += 1
Case 1
PictureBox1.Visible = True
PictureBox1.Image = System.Drawing.Image.FromFile("C:UsersJessica.JorgeA1DocumentsVisual Studio 2005ProjectsWindowsApplication1WindowsApplication1PICTURESonionhead086_thumb.gif")
iImage2 += 1
End Select
ElseIf Not (Val(Label1.Text) * Val(Label2.Text) = Val(TextBox1.Text)) Then
MsgBox("El resultado no es correcto")
Me.TextBox1.Text = ""
TextBox1.Focus()
intentosfallidos = intentosfallidos + 1
TextBox2.Text = intentosfallidos
'//////////////
Static Dim iImage0 As Integer
Select Case iImage0
Case 0
PictureBox1.Visible = True
PictureBox1.Image = System.Drawing.Image.FromFile("C:UsersJessica.JorgeA1DocumentsVisual Studio 2005ProjectsWindowsApplication1WindowsApplication1PICTURESemoticon_onion_fantasmita_gifs_animado_msnanimal_com-27.gif")
iImage0 += 1
Case 1
PictureBox1.Visible = True
PictureBox1.Image = System.Drawing.Image.FromFile("C:UsersJessica.JorgeA1DocumentsVisual Studio 2005ProjectsWindowsApplication1WindowsApplication1PICTURESonionhead007_thumb.gif")
iImage0 += 1
End Select
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Random As New Random()
Dim op2 As Integer = Random.Next(2, 10)
Label6.Text = op2
'////
Timer2.Enabled = True
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim max As Integer = 4000
Dim rnd As New Random
Dim rand As Integer = rnd.Next(10, max + 1)
Dim i As Integer = 1
Dim number(max - 1) As Integer
For i = 0 To max - 1
If number(i) = rand Then
rand = rnd.Next(1, max + 1)
i = -1
ElseIf number(i) = 0 Then
number(i) = rand
rand = rnd.Next(1, max + 1)
If i = max - 1 Then
Exit For
End If
i = -1
End If
Next
Timer1.Interval = number(i)
i += 1
ChangeImage()
End Sub
Private Sub ChangeImage()
Static Dim iImage1 As Integer
Select Case iImage1
Case 0
PictureBox1.Visible = True
PictureBox1.Image = System.Drawing.Image.FromFile("C:UsersJessica.JorgeA1DocumentsVisual Studio 2005ProjectsWindowsApplication1WindowsApplication1PICTUREScebollita_club_emoticon_yo_www.trucoslive.x10hosting.com.gif")
iImage1 += 1
Case 1
PictureBox1.Visible = True
PictureBox1.Image = System.Drawing.Image.FromFile("C:UsersJessica.JorgeA1DocumentsVisual Studio 2005ProjectsWindowsApplication1WindowsApplication1PICTURESonionhead003_thumb.gif")
iImage1 += 1
Case 2
PictureBox1.Visible = True
PictureBox1.Image = System.Drawing.Image.FromFile("C:UsersJessica.JorgeA1DocumentsVisual Studio 2005ProjectsWindowsApplication1WindowsApplication1PICTURESonionhead086_thumb.gif")
iImage1 += 1
End Select
End Sub
Sub mostrarTiempo()
Label7.Text = hora.ToString.PadLeft(2, "0") & ":"
Label7.Text &= minuto.ToString.PadLeft(2, "0") & ":"
Label7.Text &= segundo.ToString.PadLeft(2, "0") & ":"
Label7.Text &= milisegundo.ToString.PadLeft(1, "0")
Label7.Refresh()
If Label7.Text = "00:02:00:0" And TextBox3.Text >= "10" Then
MsgBox("Muy bien, ahora da click en continuar y podrás jugar", MsgBoxStyle.Information)
ElseIf Label7.Text = "00:02:00:0" And TextBox3.Text = "8" Then
MsgBox("Debes mejorar, da click en continuar y podrás jugar", MsgBoxStyle.Information)
End If
If Label7.Text > "00:02:00:0" And TextBox3.Text <= "7" Then
MsgBox("Debes volver a repetirlas", MsgBoxStyle.Information)
End If
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
milisegundo += 1
If milisegundo = 9 Then
milisegundo = 0
segundo += 1
If segundo = 59 Then
segundo = 0
minuto += 1
If minuto = 59 Then
minuto = 0
hora += 1
End If
End If
End If
mostrarTiempo()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If TextBox3.Text = "10" Or TextBox3.Text = "8" Then
Shell("C:UsersJessica.JorgeA1DocumentsSAgta.exe", AppWinStyle.NormalFocus)
End If
Me.Hide()
End Sub
End Class