Pluzzle vb.net

En este ejemplo de visual studio mostrare como editar el juego de “pluzzle”, juego que constara de un tablero de 8 x 8 en el que se deberá colocar un total de 8 círculos de los cuales no deberá haber dos círculos en la misma, columna, diagonal o hilera las cuales las diferenciaremos por color.

Aquí el diseño:


Como se puede observar necesitaremos colocar 1 button y 64 Picturebox a las cuales se le asignara el nombre del color + ubicación por ejemplo la primer PictureBox del color verde lleva el nombre de v11 y la última PictureBox lleva el nombre de gr88.

Continuando aquí enlisto las imágenes que contienen los PictureBox:


 







Las imágenes sin círculo llevan el nombre de color+f:
amrf
azf
cff
grisf
mrf
rf
rsf
vf

Las imágenes con círculo llevan el nombre de color+t:
amrt
azt
cft
grist
mrt
rt
rst
vt

Todas las imágenes so de tipo .png

Una vez se hallan colocado todos los PictureBox con su imagen respectiva pasamos al código.

Aquí el código:

 
   Public Class Form1
    'Definidendo array que contendra el estado de cada
    'PictureBox
    Dim comprobante(8, 8) As Boolean
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'All empezar el juego no hay seleccionada ninguna opcion
        'por lo que el comprobante completo debe
        'ser false
        For i As Integer = 1 To 8
            For i2 As Integer = 1 To 8
                comprobante(i, i2) = False
            Next
        Next
    End Sub

    'Editando sub para los cambios de imagen de los
    'PictureBox color verde y cambiando el estado
    'del comprobante dependiendo del PictureBox
    'presionado
    Sub changeVerde(num1 As Integer, num2 As Integer)
        For i As Integer = 1 To 4
            For i2 As Integer = 1 To 2
                If i = num1 And i2 = num2 Then
                    comprobante(i, i2) = True
                Else
                    comprobante(i, i2) = False
                End If
            Next
        Next

        If comprobante(1, 1) = False Then
            v11.ImageLocation = "vf.png"
            v11.Load()
        Else
            v11.ImageLocation = "vt.png"
            v11.Load()
        End If
        If comprobante(1, 2) = False Then
            v12.ImageLocation = "vf.png"
            v12.Load()
        Else
            v12.ImageLocation = "vt.png"
            v12.Load()
        End If
        If comprobante(2, 1) = False Then
            v21.ImageLocation = "vf.png"
            v21.Load()
        Else
            v21.ImageLocation = "vt.png"
            v21.Load()
        End If
        If comprobante(2, 2) = False Then
            v22.ImageLocation = "vf.png"
            v22.Load()
        Else
            v22.ImageLocation = "vt.png"
            v22.Load()
        End If
        If comprobante(3, 1) = False Then
            v31.ImageLocation = "vf.png"
            v31.Load()
        Else
            v31.ImageLocation = "vt.png"
            v31.Load()
        End If
        If comprobante(3, 2) = False Then
            v32.ImageLocation = "vf.png"
            v32.Load()
        Else
            v32.ImageLocation = "vt.png"
            v32.Load()
        End If
        If comprobante(4, 1) = False Then
            v41.ImageLocation = "vf.png"
            v41.Load()
        Else
            v41.ImageLocation = "vt.png"
            v41.Load()
        End If
        If comprobante(4, 2) = False Then
            v42.ImageLocation = "vf.png"
            v42.Load()
        Else
            v42.ImageLocation = "vt.png"
            v42.Load()
        End If
    End Sub

    Private Sub v11_Click(sender As Object, e As EventArgs) Handles v11.Click
        changeVerde(1, 1)
    End Sub

    Private Sub v12_Click(sender As Object, e As EventArgs) Handles v12.Click
        changeVerde(1, 2)
    End Sub

    Private Sub v21_Click(sender As Object, e As EventArgs) Handles v21.Click
        changeVerde(2, 1)
    End Sub

    Private Sub v22_Click(sender As Object, e As EventArgs) Handles v22.Click
        changeVerde(2, 2)
    End Sub

    Private Sub v31_Click(sender As Object, e As EventArgs) Handles v31.Click
        changeVerde(3, 1)
    End Sub

    Private Sub v32_Click(sender As Object, e As EventArgs) Handles v32.Click
        changeVerde(3, 2)
    End Sub

    Private Sub v41_Click(sender As Object, e As EventArgs) Handles v41.Click
        changeVerde(4, 1)
    End Sub

    Private Sub v42_Click(sender As Object, e As EventArgs) Handles v42.Click
        changeVerde(4, 2)
    End Sub

    'Editando sub para los cambios de imagen de los
    'PictureBox color rojo y cambiando el estado
    'del comprobante dependiendo del PictureBox
    'presionado
    Sub changeRojo(num1 As Integer, num2 As Integer)
        For i As Integer = 1 To 4
            For i2 As Integer = 3 To 4
                If i = num1 And i2 = num2 Then
                    comprobante(i, i2) = True
                Else
                    comprobante(i, i2) = False
                End If
            Next
        Next
        If comprobante(1, 3) = False Then
            r13.ImageLocation = "rf.png"
            r13.Load()
        Else
            r13.ImageLocation = "rt.png"
            r13.Load()
        End If
        If comprobante(1, 4) = False Then
            r14.ImageLocation = "rf.png"
            r14.Load()
        Else
            r14.ImageLocation = "rt.png"
            r14.Load()
        End If
        If comprobante(2, 3) = False Then
            r23.ImageLocation = "rf.png"
            r23.Load()
        Else
            r23.ImageLocation = "rt.png"
            r23.Load()
        End If
        If comprobante(2, 4) = False Then
            r24.ImageLocation = "rf.png"
            r24.Load()
        Else
            r24.ImageLocation = "rt.png"
            r24.Load()
        End If
        If comprobante(3, 3) = False Then
            r33.ImageLocation = "rf.png"
            r33.Load()
        Else
            r33.ImageLocation = "rt.png"
            r33.Load()
        End If
        If comprobante(3, 4) = False Then
            r34.ImageLocation = "rf.png"
            r34.Load()
        Else
            r34.ImageLocation = "rt.png"
            r34.Load()
        End If
        If comprobante(4, 3) = False Then
            r43.ImageLocation = "rf.png"
            r43.Load()
        Else
            r43.ImageLocation = "rt.png"
            r43.Load()
        End If
        If comprobante(4, 4) = False Then
            r44.ImageLocation = "rf.png"
            r44.Load()
        Else
            r44.ImageLocation = "rt.png"
            r44.Load()
        End If
    End Sub

    Private Sub r13_Click(sender As Object, e As EventArgs) Handles r13.Click
        changeRojo(1, 3)
    End Sub

    Private Sub r14_Click(sender As Object, e As EventArgs) Handles r14.Click
        changeRojo(1, 4)
    End Sub

    Private Sub r23_Click(sender As Object, e As EventArgs) Handles r23.Click
        changeRojo(2, 3)
    End Sub

    Private Sub r24_Click(sender As Object, e As EventArgs) Handles r24.Click
        changeRojo(2, 4)
    End Sub

    Private Sub r33_Click(sender As Object, e As EventArgs) Handles r33.Click
        changeRojo(3, 3)
    End Sub

    Private Sub r34_Click(sender As Object, e As EventArgs) Handles r34.Click
        changeRojo(3, 4)
    End Sub

    Private Sub r43_Click(sender As Object, e As EventArgs) Handles r43.Click
        changeRojo(4, 3)
    End Sub

    Private Sub r44_Click(sender As Object, e As EventArgs) Handles r44.Click
        changeRojo(4, 4)
    End Sub

    'Editando sub para los cambios de imagen de los
    'PictureBox color Morado y cambiando el estado
    'del comprobante dependiendo del PictureBox
    'presionado
    Sub changeMorado(num1 As Integer, num2 As Integer)
        For i As Integer = 5 To 8
            For i2 As Integer = 5 To 6
                If i = num1 And i2 = num2 Then
                    comprobante(i, i2) = True
                Else
                    comprobante(i, i2) = False
                End If
            Next
        Next
        If comprobante(5, 5) = False Then
            mr55.ImageLocation = "mrf.png"
            mr55.Load()
        Else
            mr55.ImageLocation = "mrt.png"
            mr55.Load()
        End If
        If comprobante(5, 6) = False Then
            mr56.ImageLocation = "mrf.png"
            mr56.Load()
        Else
            mr56.ImageLocation = "mrt.png"
            mr56.Load()
        End If
        If comprobante(6, 5) = False Then
            mr65.ImageLocation = "mrf.png"
            mr65.Load()
        Else
            mr65.ImageLocation = "mrt.png"
            mr65.Load()
        End If
        If comprobante(6, 6) = False Then
            mr66.ImageLocation = "mrf.png"
            mr66.Load()
        Else
            mr66.ImageLocation = "mrt.png"
            mr66.Load()
        End If
        If comprobante(7, 5) = False Then
            mr75.ImageLocation = "mrf.png"
            mr75.Load()
        Else
            mr75.ImageLocation = "mrt.png"
            mr75.Load()
        End If
        If comprobante(7, 6) = False Then
            mr76.ImageLocation = "mrf.png"
            mr76.Load()
        Else
            mr76.ImageLocation = "mrt.png"
            mr76.Load()
        End If
        If comprobante(8, 5) = False Then
            mr85.ImageLocation = "mrf.png"
            mr85.Load()
        Else
            mr85.ImageLocation = "mrt.png"
            mr85.Load()
        End If
        If comprobante(8, 6) = False Then
            mr86.ImageLocation = "mrf.png"
            mr86.Load()
        Else
            mr86.ImageLocation = "mrt.png"
            mr86.Load()
        End If
    End Sub

    Private Sub mr55_Click(sender As Object, e As EventArgs) Handles mr55.Click
        changeMorado(5, 5)
    End Sub

    Private Sub mr56_Click(sender As Object, e As EventArgs) Handles mr56.Click
        changeMorado(5, 6)
    End Sub

    Private Sub mr65_Click(sender As Object, e As EventArgs) Handles mr65.Click
        changeMorado(6, 5)
    End Sub

    Private Sub mr66_Click(sender As Object, e As EventArgs) Handles mr66.Click
        changeMorado(6, 6)
    End Sub

    Private Sub mr75_Click(sender As Object, e As EventArgs) Handles mr75.Click
        changeMorado(7, 5)
    End Sub

    Private Sub mr76_Click(sender As Object, e As EventArgs) Handles mr76.Click
        changeMorado(7, 6)
    End Sub

    Private Sub mr85_Click(sender As Object, e As EventArgs) Handles mr85.Click
        changeMorado(8, 5)
    End Sub

    Private Sub mr86_Click(sender As Object, e As EventArgs) Handles mr86.Click
        changeMorado(8, 6)
    End Sub

    'Editando sub para los cambios de imagen de los
    'PictureBox color gris y cambiando el estado
    'del comprobante dependiendo del PictureBox
    'presionado
    Sub changeGris(num1 As Integer, num2 As Integer)
        Dim imgf As String, imgt As String
        imgf = "grisf.png"
        imgt = "grist.png"
        For i As Integer = 5 To 8
            For i2 As Integer = 7 To 8
                If i = num1 And i2 = num2 Then
                    comprobante(i, i2) = True
                Else
                    comprobante(i, i2) = False
                End If
            Next
        Next
        If comprobante(5, 7) = False Then
            gr57.ImageLocation = imgf
            gr57.Load()
        Else
            gr57.ImageLocation = imgt
            gr57.Load()
        End If
        If comprobante(5, 8) = False Then
            gr58.ImageLocation = imgf
            gr58.Load()
        Else
            gr58.ImageLocation = imgt
            gr58.Load()
        End If
        If comprobante(6, 7) = False Then
            gr67.ImageLocation = imgf
            gr67.Load()
        Else
            gr67.ImageLocation = imgt
            gr67.Load()
        End If
        If comprobante(6, 8) = False Then
            gr68.ImageLocation = imgf
            gr68.Load()
        Else
            gr68.ImageLocation = imgt
            gr68.Load()
        End If
        If comprobante(7, 7) = False Then
            gr77.ImageLocation = imgf
            gr77.Load()
        Else
            gr77.ImageLocation = imgt
            gr77.Load()
        End If
        If comprobante(7, 8) = False Then
            gr78.ImageLocation = imgf
            gr78.Load()
        Else
            gr78.ImageLocation = imgt
            gr78.Load()
        End If
        If comprobante(8, 7) = False Then
            gr87.ImageLocation = imgf
            gr87.Load()
        Else
            gr87.ImageLocation = imgt
            gr87.Load()
        End If
        If comprobante(8, 8) = False Then
            gr88.ImageLocation = imgf
            gr88.Load()
        Else
            gr88.ImageLocation = imgt
            gr88.Load()
        End If
    End Sub

    Private Sub gr57_Click(sender As Object, e As EventArgs) Handles gr57.Click
        changeGris(5, 7)
    End Sub

    Private Sub gr58_Click(sender As Object, e As EventArgs) Handles gr58.Click
        changeGris(5, 8)
    End Sub

    Private Sub gr67_Click(sender As Object, e As EventArgs) Handles gr67.Click
        changeGris(6, 7)
    End Sub

    Private Sub gr68_Click(sender As Object, e As EventArgs) Handles gr68.Click
        changeGris(6, 8)
    End Sub

    Private Sub gr77_Click(sender As Object, e As EventArgs) Handles gr77.Click
        changeGris(7, 7)
    End Sub

    Private Sub gr78_Click(sender As Object, e As EventArgs) Handles gr78.Click
        changeGris(7, 8)
    End Sub

    Private Sub gr87_Click(sender As Object, e As EventArgs) Handles gr87.Click
        changeGris(8, 7)
    End Sub

    Private Sub gr88_Click(sender As Object, e As EventArgs) Handles gr88.Click
        changeGris(8, 8)
    End Sub
    'Editando sub para los cambios de imagen de los
    'PictureBox color Amarillo y cambiando el estado
    'del comprobante dependiendo del PictureBox
    'presionado
    Sub changeAmarillo(num1 As Integer, num2 As Integer)
        Dim imgf As String, imgt As String
        imgf = "amrf.png"
        imgt = "amrt.png"
        For i As Integer = 1 To 2
            For i2 As Integer = 5 To 8
                If i = num1 And i2 = num2 Then
                    comprobante(i, i2) = True
                Else
                    comprobante(i, i2) = False
                End If
            Next
        Next
        If comprobante(1, 5) = False Then
            amr15.ImageLocation = imgf
            amr15.Load()
        Else
            amr15.ImageLocation = imgt
            amr15.Load()
        End If
        If comprobante(1, 6) = False Then
            amr16.ImageLocation = imgf
            amr16.Load()
        Else
            amr16.ImageLocation = imgt
            amr16.Load()
        End If
        If comprobante(1, 7) = False Then
            amr17.ImageLocation = imgf
            amr17.Load()
        Else
            amr17.ImageLocation = imgt
            amr17.Load()
        End If
        If comprobante(1, 8) = False Then
            amr18.ImageLocation = imgf
            amr18.Load()
        Else
            amr18.ImageLocation = imgt
            amr18.Load()
        End If
        If comprobante(2, 5) = False Then
            amr25.ImageLocation = imgf
            amr25.Load()
        Else
            amr25.ImageLocation = imgt
            amr25.Load()
        End If
        If comprobante(2, 6) = False Then
            amr26.ImageLocation = imgf
            amr26.Load()
        Else
            amr26.ImageLocation = imgt
            amr26.Load()
        End If
        If comprobante(2, 7) = False Then
            amr27.ImageLocation = imgf
            amr27.Load()
        Else
            amr27.ImageLocation = imgt
            amr27.Load()
        End If
        If comprobante(2, 8) = False Then
            amr28.ImageLocation = imgf
            amr28.Load()
        Else
            amr28.ImageLocation = imgt
            amr28.Load()
        End If
    End Sub

    Private Sub amr15_Click(sender As Object, e As EventArgs) Handles amr15.Click
        changeAmarillo(1, 5)
    End Sub

    Private Sub amr16_Click(sender As Object, e As EventArgs) Handles amr16.Click
        changeAmarillo(1, 6)
    End Sub

    Private Sub amr17_Click(sender As Object, e As EventArgs) Handles amr17.Click
        changeAmarillo(1, 7)
    End Sub

    Private Sub amr18_Click(sender As Object, e As EventArgs) Handles amr18.Click
        changeAmarillo(1, 8)
    End Sub

    Private Sub amr25_Click(sender As Object, e As EventArgs) Handles amr25.Click
        changeAmarillo(2, 5)
    End Sub

    Private Sub amr26_Click(sender As Object, e As EventArgs) Handles amr26.Click
        changeAmarillo(2, 6)
    End Sub

    Private Sub amr27_Click(sender As Object, e As EventArgs) Handles amr27.Click
        changeAmarillo(2, 7)
    End Sub

    Private Sub amr28_Click(sender As Object, e As EventArgs) Handles amr28.Click
        changeAmarillo(2, 8)
    End Sub
    'Editando sub para los cambios de imagen de los
    'PictureBox color azul y cambiando el estado
    'del comprobante dependiendo del PictureBox
    'presionado
    Sub ChangeAzul(num1 As Integer, num2 As Integer)
        Dim imgf As String, imgt As String
        imgf = "azf.png"
        imgt = "azt.png"
        For i As Integer = 3 To 4
            For i2 As Integer = 5 To 8
                If i = num1 And i2 = num2 Then
                    comprobante(i, i2) = True
                Else
                    comprobante(i, i2) = False
                End If
            Next
        Next
        If comprobante(3, 5) = False Then
            az35.ImageLocation = imgf
            az35.Load()
        Else
            az35.ImageLocation = imgt
            az35.Load()
        End If
        If comprobante(3, 6) = False Then
            az36.ImageLocation = imgf
            az36.Load()
        Else
            az36.ImageLocation = imgt
            az36.Load()
        End If
        If comprobante(3, 7) = False Then
            az37.ImageLocation = imgf
            az37.Load()
        Else
            az37.ImageLocation = imgt
            az37.Load()
        End If
        If comprobante(3, 8) = False Then
            az38.ImageLocation = imgf
            az38.Load()
        Else
            az38.ImageLocation = imgt
            az38.Load()
        End If
        If comprobante(4, 5) = False Then
            az45.ImageLocation = imgf
            az45.Load()
        Else
            az45.ImageLocation = imgt
            az45.Load()
        End If

        If comprobante(4, 6) = False Then
            az46.ImageLocation = imgf
            az46.Load()
        Else
            az46.ImageLocation = imgt
            az46.Load()
        End If


        If comprobante(4, 7) = False Then
            az47.ImageLocation = imgf
            az47.Load()
        Else
            az47.ImageLocation = imgt
            az47.Load()
        End If

        If comprobante(4, 8) = False Then
            az48.ImageLocation = imgf
            az48.Load()
        Else
            az48.ImageLocation = imgt
            az48.Load()
        End If

    End Sub

    Private Sub az35_Click(sender As Object, e As EventArgs) Handles az35.Click
        ChangeAzul(3, 5)
    End Sub

    Private Sub az36_Click(sender As Object, e As EventArgs) Handles az36.Click
        ChangeAzul(3, 6)
    End Sub

    Private Sub az37_Click(sender As Object, e As EventArgs) Handles az37.Click
        ChangeAzul(3, 7)
    End Sub

    Private Sub az38_Click(sender As Object, e As EventArgs) Handles az38.Click
        ChangeAzul(3, 8)
    End Sub

    Private Sub az45_Click(sender As Object, e As EventArgs) Handles az45.Click
        ChangeAzul(4, 5)
    End Sub

    Private Sub az46_Click(sender As Object, e As EventArgs) Handles az46.Click
        ChangeAzul(4, 6)
    End Sub

    Private Sub az47_Click(sender As Object, e As EventArgs) Handles az47.Click
        ChangeAzul(4, 7)
    End Sub

    Private Sub az48_Click(sender As Object, e As EventArgs) Handles az48.Click
        ChangeAzul(4, 8)
    End Sub

    'Editando sub para los cambios de imagen de los
    'PictureBox color rosado y cambiando el estado
    'del comprobante dependiendo del PictureBox
    'presionado
    Sub ChangeRosado(num1 As Integer, num2 As Integer)
        Dim imgf As String, imgt As String
        imgf = "rsf.png"
        imgt = "rst.png"
        For i As Integer = 5 To 6
            For i2 As Integer = 1 To 4
                If i = num1 And i2 = num2 Then
                    comprobante(i, i2) = True
                Else
                    comprobante(i, i2) = False
                End If


            Next
        Next

        If comprobante(5, 1) = False Then
            rs51.ImageLocation = imgf
            rs51.Load()
        Else
            rs51.ImageLocation = imgt
            rs51.Load()
        End If

        If comprobante(5, 2) = False Then
            rs52.ImageLocation = imgf
            rs52.Load()
        Else
            rs52.ImageLocation = imgt
            rs52.Load()
        End If


        If comprobante(5, 3) = False Then
            rs53.ImageLocation = imgf
            rs53.Load()
        Else
            rs53.ImageLocation = imgt
            rs53.Load()
        End If

        If comprobante(5, 4) = False Then
            rs54.ImageLocation = imgf
            rs54.Load()
        Else
            rs54.ImageLocation = imgt
            rs54.Load()
        End If

        '--
        If comprobante(6, 1) = False Then
            rs61.ImageLocation = imgf
            rs61.Load()
        Else
            rs61.ImageLocation = imgt
            rs61.Load()
        End If

        If comprobante(6, 2) = False Then
            rs62.ImageLocation = imgf
            rs62.Load()
        Else
            rs62.ImageLocation = imgt
            rs62.Load()
        End If


        If comprobante(6, 3) = False Then
            rs63.ImageLocation = imgf
            rs63.Load()
        Else
            rs63.ImageLocation = imgt
            rs63.Load()
        End If

        If comprobante(6, 4) = False Then
            rs64.ImageLocation = imgf
            rs64.Load()
        Else
            rs64.ImageLocation = imgt
            rs64.Load()
        End If


    End Sub


    Private Sub rs51_Click(sender As Object, e As EventArgs) Handles rs51.Click
        ChangeRosado(5, 1)
    End Sub

    Private Sub rs52_Click(sender As Object, e As EventArgs) Handles rs52.Click
        ChangeRosado(5, 2)
    End Sub

    Private Sub rs53_Click(sender As Object, e As EventArgs) Handles rs53.Click
        ChangeRosado(5, 3)
    End Sub

    Private Sub rs54_Click(sender As Object, e As EventArgs) Handles rs54.Click
        ChangeRosado(5, 4)
    End Sub

    Private Sub rs61_Click(sender As Object, e As EventArgs) Handles rs61.Click
        ChangeRosado(6, 1)
    End Sub

    Private Sub rs62_Click(sender As Object, e As EventArgs) Handles rs62.Click
        ChangeRosado(6, 2)
    End Sub

    Private Sub rs63_Click(sender As Object, e As EventArgs) Handles rs63.Click
        ChangeRosado(6, 3)
    End Sub

    Private Sub rs64_Click(sender As Object, e As EventArgs) Handles rs64.Click
        ChangeRosado(6, 4)
    End Sub


    'Editando sub para los cambios de imagen de los
    'PictureBox color cafe y cambiando el estado
    'del comprobante dependiendo del PictureBox
    'presionado
    Sub ChangeCafe(num1 As Integer, num2 As Integer)
        Dim imgf As String, imgt As String
        imgf = "cff.png"
        imgt = "cft.png"
        For i As Integer = 7 To 8
            For i2 As Integer = 1 To 4
                If i = num1 And i2 = num2 Then
                    comprobante(i, i2) = True
                Else
                    comprobante(i, i2) = False
                End If


            Next
        Next

        If comprobante(7, 1) = False Then
            cf71.ImageLocation = imgf
            cf71.Load()
        Else
            cf71.ImageLocation = imgt
            cf71.Load()
        End If

        If comprobante(7, 2) = False Then
            cf72.ImageLocation = imgf
            cf72.Load()
        Else
            cf72.ImageLocation = imgt
            cf72.Load()
        End If


        If comprobante(7, 3) = False Then
            cf73.ImageLocation = imgf
            cf73.Load()
        Else
            cf73.ImageLocation = imgt
            cf73.Load()
        End If

        If comprobante(7, 4) = False Then
            cf74.ImageLocation = imgf
            cf74.Load()
        Else
            cf74.ImageLocation = imgt
            cf74.Load()
        End If

        '--

        If comprobante(8, 1) = False Then
            cf81.ImageLocation = imgf
            cf81.Load()
        Else
            cf81.ImageLocation = imgt
            cf81.Load()
        End If

        If comprobante(8, 2) = False Then
            cf82.ImageLocation = imgf
            cf82.Load()
        Else
            cf82.ImageLocation = imgt
            cf82.Load()
        End If


        If comprobante(8, 3) = False Then
            cf83.ImageLocation = imgf
            cf83.Load()
        Else
            cf83.ImageLocation = imgt
            cf83.Load()
        End If

        If comprobante(8, 4) = False Then
            cf84.ImageLocation = imgf
            cf84.Load()
        Else
            cf84.ImageLocation = imgt
            cf84.Load()
        End If


    End Sub


    Private Sub cf71_Click(sender As Object, e As EventArgs) Handles cf71.Click
        ChangeCafe(7, 1)
    End Sub

    Private Sub cf72_Click(sender As Object, e As EventArgs) Handles cf72.Click
        ChangeCafe(7, 2)
    End Sub

    Private Sub cf73_Click(sender As Object, e As EventArgs) Handles cf73.Click
        ChangeCafe(7, 3)
    End Sub

    Private Sub cf74_Click(sender As Object, e As EventArgs) Handles cf74.Click
        ChangeCafe(7, 4)
    End Sub

    Private Sub cf81_Click(sender As Object, e As EventArgs) Handles cf81.Click
        ChangeCafe(8, 1)
    End Sub

    Private Sub cf82_Click(sender As Object, e As EventArgs) Handles cf82.Click
        ChangeCafe(8, 2)
    End Sub

    Private Sub cf83_Click(sender As Object, e As EventArgs) Handles cf83.Click
        ChangeCafe(8, 3)
    End Sub

    Private Sub cf84_Click(sender As Object, e As EventArgs) Handles cf84.Click
        ChangeCafe(8, 4)
    End Sub

    'Editando sub del Button1 el cual seria
    'para la comprobacion de que no se repite
    'El circulo tanto en la columna, diagonal
    'o hilera


    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim contx As Integer
        Dim conty As Integer
        Dim cc As Integer
        contx = 0
        conty = 0
        cc = 0
        For i As Integer = 1 To 8
            For i2 As Integer = 1 To 8
                If comprobante(i, i2) = True And cc <> i Then
                    conty = conty + 1
                    cc = i
                End If
            Next
            cc = 0
        Next

        For i As Integer = 1 To 8
            For i2 As Integer = 1 To 8
                If comprobante(i2, i) = True And cc <> i Then
                    contx = contx + 1
                    cc = i
                End If
            Next
            cc = 0
        Next

        If contx = 8 And conty = 8 Then
            MsgBox("correcto")
        Else
            MsgBox("Incorrecto")
        End If


    End Sub
End Class 












Ahora que ya está creado es juego ¿podrás resolverlo?

Saludos.

Comentarios

Entradas más populares de este blog

Ejemplo de suma Pascal

Solucion al error collation desconocida: 'utf8mb4_0900_ai_ci'