Public Class Form1
Dim
x As Integer
Dim
y As Integer
Private
Sub Button10_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles Button10.Click
Dim Random As New Random()
Randomize()
Button1.Text =
Random.Next(0, 9)
Button2.Text =
Random.Next(0, 9)
While (Button2.Text = Button1.Text)
Button2.Text =
Random.Next(0, 9)
End While
Button3.Text =
Random.Next(0, 9)
While (Button3.Text = Button1.Text Or Button3.Text = Button2.Text)
Button3.Text =
Random.Next(0, 9)
End While
Button4.Text =
Random.Next(0, 9)
While (Button4.Text = Button1.Text Or Button4.Text = Button2.Text Or Button4.Text = Button3.Text)
Button4.Text =
Random.Next(0, 9)
End While
Button5.Text =
Random.Next(0, 9)
While (Button5.Text = Button1.Text Or Button5.Text = Button2.Text Or Button5.Text = Button3.Text Or Button5.Text = Button4.Text)
Button5.Text =
Random.Next(0, 8)
End While
Button6.Text =
Random.Next(0, 9)
While (Button6.Text = Button1.Text Or Button6.Text = Button2.Text Or Button6.Text = Button3.Text Or Button6.Text = Button4.Text Or Button6.Text = Button5.Text)
Button6.Text =
Random.Next(0, 8)
End While
Button7.Text =
Random.Next(0, 9)
While (Button7.Text = Button1.Text Or Button7.Text = Button2.Text Or Button7.Text = Button3.Text Or Button7.Text = Button4.Text Or Button7.Text = Button5.Text Or Button7.Text = Button6.Text)
Button7.Text =
Random.Next(0, 8)
End While
Button8.Text = Random.Next(0,
9)
While (Button8.Text = Button1.Text Or Button8.Text = Button2.Text Or Button8.Text = Button3.Text Or Button8.Text = Button4.Text Or Button8.Text = Button5.Text Or Button8.Text = Button6.Text Or Button8.Text = Button7.Text)
Button8.Text =
Random.Next(0, 8)
End While
Button9.Text =
Random.Next(0, 9)
While (Button9.Text = Button1.Text Or Button9.Text = Button2.Text Or Button9.Text = Button3.Text Or Button9.Text = Button4.Text Or Button9.Text = Button5.Text Or Button9.Text = Button6.Text Or Button9.Text = Button7.Text Or Button9.Text = Button8.Text)
Button9.Text =
Random.Next(0, 9)
End While
If Button1.Text = 0 Then
Button1.Text = ""
x = Me.Button1.Location.X
y = Me.Button1.Location.Y
Else
If Button2.Text = 0 Then
Button2.Text =
""
x = Me.Button2.Location.X
y = Me.Button2.Location.Y
Else
If
Button3.Text = 0 Then
Button3.Text = ""
x = Me.Button3.Location.X
y = Me.Button3.Location.Y
Else
If Button4.Text = 0 Then
Button4.Text = ""
x = Me.Button4.Location.X
y = Me.Button4.Location.Y
Else
If Button5.Text = 0 Then
Button5.Text = ""
x = Me.Button5.Location.X
y
= Me.Button5.Location.Y
Else
If Button6.Text = 0 Then
Button6.Text = ""
x = Me.Button6.Location.X
y = Me.Button6.Location.Y
Else
If Button7.Text = 0 Then
Button7.Text = ""
x = Me.Button7.Location.X
y = Me.Button7.Location.Y
Else
If Button8.Text = 0 Then
Button8.Text = ""
x =
Me.Button8.Location.X
y =
Me.Button8.Location.Y
Else
If Button9.Text = 0 Then
Button9.Text = ""
x = Me.Button9.Location.X
y = Me.Button9.Location.Y
End If
End If
End If
End If
End If
End If
End If
End If
End If
End
Sub
Private
Sub Button11_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles Button11.Click
End
End
Sub
Private
Sub Button6_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles Button6.Click
If x = 215 And y
= 29 Then
Button3.Text =
Button6.Text
Button6.Text = ""
x = Me.Button6.Location.X
y = Me.Button6.Location.Y
Else
If x = 121 And y
= 109 Then
Button5.Text =
Button6.Text
Button6.Text =
""
x = Me.Button6.Location.X
y = Me.Button6.Location.Y
Else
If x = 215 And y
= 189 Then
Button9.Text = Button6.Text
Button6.Text = ""
x = Me.Button6.Location.X
y = Me.Button6.Location.Y
End If
End If
End If
Call PROC1()
End
Sub
Private
Sub Button1_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles Button1.Click
If x = 121 And y
= 29 Then
Button2.Text =
Button1.Text
Button1.Text = ""
x = Me.Button1.Location.X
y = Me.Button1.Location.Y
Else
If x = 29 And y =
109 Then
Button4.Text =
Button1.Text
Button1.Text =
""
x = Me.Button1.Location.X
y = Me.Button1.Location.Y
End If
End If
Call PROC1()
End
Sub
Private
Sub Button2_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles Button2.Click
If x = 29 And y =
29 Then
Button1.Text =
Button2.Text
Button2.Text = ""
x = Me.Button2.Location.X
y = Me.Button2.Location.Y
Else
If x = 121 And y
= 109 Then
Button5.Text =
Button2.Text
Button2.Text =
""
x = Me.Button2.Location.X
y = Me.Button2.Location.Y
Else
If x = 215 And y
= 29 Then
Button3.Text = Button2.Text
Button2.Text = ""
x = Me.Button2.Location.X
y = Me.Button2.Location.Y
End If
End If
End If
Call PROC1()
End
Sub
Private
Sub Button3_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles Button3.Click
If x = 121 And y
= 29 Then
Button2.Text =
Button3.Text
Button3.Text = ""
x = Me.Button3.Location.X
y = Me.Button3.Location.Y
Else
If x = 215 And y
= 109 Then
Button6.Text =
Button3.Text
Button3.Text =
""
x = Me.Button3.Location.X
y = Me.Button3.Location.Y
End If
End If
Call PROC1()
End
Sub
Private
Sub Button4_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles Button4.Click
If x = 29 And y =
29 Then
Button1.Text =
Button4.Text
Button4.Text = ""
x = Me.Button4.Location.X
y = Me.Button4.Location.Y
Else
If x = 121 And y
= 109 Then
Button5.Text =
Button4.Text
Button4.Text =
""
x = Me.Button4.Location.X
y = Me.Button4.Location.Y
Else
If x = 29 And y =
189 Then
Button7.Text = Button4.Text
Button4.Text = ""
x = Me.Button4.Location.X
y = Me.Button4.Location.Y
End If
End If
End If
Call PROC1()
End
Sub
Private
Sub Button5_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles Button5.Click
If x = 121 And y
= 29 Then
Button2.Text =
Button5.Text
Button5.Text = ""
x = Me.Button5.Location.X
y = Me.Button5.Location.Y
Else
If x = 29 And y =
109 Then
Button4.Text =
Button5.Text
Button5.Text =
""
x = Me.Button5.Location.X
y = Me.Button5.Location.Y
Else
If x = 215 And y
= 109 Then
Button6.Text = Button5.Text
Button5.Text = ""
x = Me.Button5.Location.X
y = Me.Button5.Location.Y
Else
If x = 121 And y
= 189 Then
Button8.Text = Button5.Text
Button5.Text = ""
x = Me.Button5.Location.X
y = Me.Button5.Location.Y
End If
End If
End If
End If
Call PROC1()
End
Sub
Private
Sub Button7_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles Button7.Click
If x = 29 And y =
109 Then
Button4.Text =
Button7.Text
Button7.Text = ""
x = Me.Button7.Location.X
y = Me.Button7.Location.Y
Else
If x = 121 And y =
189 Then
Button8.Text =
Button7.Text
Button7.Text =
""
x = Me.Button7.Location.X
y = Me.Button7.Location.Y
End If
End If
Call PROC1()
End
Sub
Private
Sub Button8_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles Button8.Click
If x = 121 And y
= 109 Then
Button5.Text =
Button8.Text
Button8.Text = ""
x = Me.Button8.Location.X
y = Me.Button8.Location.Y
Else
If x = 29 And y =
189 Then
Button7.Text =
Button8.Text
Button8.Text =
""
x = Me.Button8.Location.X
y = Me.Button8.Location.Y
Else
If x = 215 And y
= 189 Then
Button9.Text = Button8.Text
Button8.Text = ""
x = Me.Button8.Location.X
y = Me.Button8.Location.Y
End If
End If
End If
Call PROC1()
End
Sub
Private
Sub Button9_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles Button9.Click
If x = 215 And y = 109 Then
Button6.Text =
Button9.Text
Button9.Text = ""
x = Me.Button9.Location.X
y = Me.Button9.Location.Y
Else
If x = 121 And y
= 189 Then
Button8.Text =
Button9.Text
Button9.Text = ""
x = Me.Button9.Location.X
y = Me.Button9.Location.Y
End If
End If
Call PROC1()
End
Sub
Sub
PROC1()
If Button1.Text = "1"
And Button2.Text = "2"
And Button3.Text = "3"
And Button4.Text = "4"
And Button5.Text = "5"
And Button6.Text = "6"
And Button7.Text = "7"
And Button8.Text = "8"
Then
MsgBox("GANASTE!!!!!")
End If
End
Sub
End Class
|
No hay comentarios:
Publicar un comentario