1.  Create a grid containing 20 numbers (20 buttons: button1, button2, …button20)
2.  When the form is loaded, the buttons are supposed to have a specific Back Color.
3.  The player can choose only 6 numbers from the grid.
4.  Whenever the number is chosen, its back color should be automatically changed.
(Chosen numbers should have different color from the other buttons)
5.  Whenever the user decides to get the result, he should press the “Get Result” button.
6.  When the “Get Result” button is pressed, the chosen numbers should be compared to the generated random numbers to display the following:
•   Guessed numbers.
•   Total of guessed numbers.
You should write a function to generate the 6 different random numbers.

If Total guessed is 1, 2 or 3 then the user wins the third prize.
If Total guessed is 4 or 5 then the user wins the second prize.
If Total guessed is 6 then the user wins the first prize.
using arrays

my problem is with the get result button/
i tried many codes but didn't work.
how to use array to compare the guessed numbers
thanks :)

Public Class frmlotto
    Dim counter As Integer = 0
    Dim btn1 As Integer = 0
    Dim btn2 As Integer = 0
    Dim btn3 As Integer = 0
    Dim btn4 As Integer = 0
    Dim btn5 As Integer = 0
    Dim btn6 As Integer = 0
    Dim btn7 As Integer = 0
    Dim btn8 As Integer = 0
    Dim btn9 As Integer = 0
    Dim btn10 As Integer = 0
    Dim btn11 As Integer = 0
    Dim btn12 As Integer = 0
    Dim btn13 As Integer = 0
    Dim btn14 As Integer = 0
    Dim btn15 As Integer = 0
    Dim btn16 As Integer = 0
    Dim btn17 As Integer = 0
    Dim btn18 As Integer = 0
    Dim btn19 As Integer = 0
    Dim btn20 As Integer = 0
    Dim win1
    Dim win2
    Dim win3
    Dim win4
    Dim win5
    Dim win6

    Sub numbers(ByRef nb1, ByRef nb2, ByRef nb3, ByRef nb4, ByRef nb5, ByRef nb6)
        Dim randomnumber As New Random()

        nb1 = randomnumber.Next(1, 21)
        nb2 = randomnumber.Next(1, 21)
        nb3 = randomnumber.Next(1, 21)
        nb4 = randomnumber.Next(1, 21)
        nb5 = randomnumber.Next(1, 21)
        nb6 = randomnumber.Next(1, 21)

        Do While (nb2 = nb1)
            nb2 = randomnumber.Next(1, 21)
        Loop

        Do While (nb3 = nb1 OrElse nb3 = nb2)
            nb3 = randomnumber.Next(1, 21)
        Loop

        Do While (nb4 = nb3 OrElse nb4 = nb2 OrElse nb4 = nb1)
            nb4 = randomnumber.Next(1, 21)
        Loop

        Do While (nb5 = nb4 OrElse nb5 = nb3 OrElse nb5 = nb2 OrElse nb5 = nb1)
            nb5 = randomnumber.Next(1, 21)
        Loop

        Do While (nb6 = nb5 OrElse nb6 = nb4 OrElse nb6 = nb3 OrElse nb6 = nb2 OrElse nb6 = nb1)
            nb6 = randomnumber.Next(1, 21)
        Loop

    End Sub

    Sub colorchg(ByRef button, ByRef cntr)

        Dim clickbtn As Integer


        If clickbtn < 6 And cntr = 0 Then

            button.BackColor = Color.Aqua
            clickbtn = clickbtn + 1
            cntr = 1

            lstbox.Items.Add(button.Text)

        ElseIf clickbtn <= 6 And cntr = 1 Then
            button.BackColor = Color.Gray
            cntr = 0


            lstbox.Items.Remove(button.Text)
            clickbtn = clickbtn - 1

        ElseIf clickbtn > 6 And cntr = 0 Then

            button.enabled = False
        End If

    End Sub


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        colorchg(Button1, btn1)
        counter += 1


    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        colorchg(Button2, btn2)
        counter += 1
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        colorchg(Button3, btn3)
        counter += 1
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        colorchg(Button4, btn4)
        counter += 1
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        colorchg(Button5, btn5)
        counter += 1
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        colorchg(Button6, btn6)
        counter += 1
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        colorchg(Button7, btn7)
        counter += 1
    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        colorchg(Button8, btn8)
        counter += 1
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        colorchg(Button9, btn9)
        counter += 1
    End Sub

    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
        colorchg(Button10, btn10)
        counter += 1
    End Sub

    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
        colorchg(Button11, btn11)
        counter += 1
    End Sub

    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
        colorchg(Button12, btn12)
        counter += 1
    End Sub

    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
        colorchg(Button13, btn13)
        counter += 1
    End Sub

    Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
        colorchg(Button14, btn14)
        counter += 1
    End Sub

    Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
        colorchg(Button15, btn15)
        counter += 1
    End Sub

    Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
        colorchg(Button16, btn16)
        counter += 1
    End Sub

    Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click
        colorchg(Button17, btn17)
        counter += 1
    End Sub

    Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button18.Click
        colorchg(Button18, btn18)
        counter += 1
    End Sub

    Private Sub Button19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button19.Click
        colorchg(Button19, btn19)
        counter += 1
    End Sub

    Private Sub Button20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button20.Click
        colorchg(Button20, btn20)
        counter += 1
    End Sub
this is what i did so far
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.