Public Class Form1

    'Each of these are variables, variables store data like a container, and these have been defined to hold one type of data e.g. Color
    'each one can be used to store a different value
    Dim LCDon As Color
    Dim LCDoff As Color
    'these have been defined to store a color value e.g. lime
    Dim Part(7) As Label
    'the variable Part(7) is an array, meaning there are 8 (including 0) separate variables of the same type.
    'this array is for the different labels we made, it simplifies the name so when we refer to it we don't have to type the whole name

    'when we define variables under the 'Public Class' it makes them global variables
    'meaning they apply to the whole code
    'if we define them under a 'Private Sub' they only apply in that sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Any code past here^ you do not need to understand
        'when an event happens (e.g. Form1 loads and starts up) the private sub (subroutine) associated with that event is run

        'we could use Part(0) but haven't to simplify things
        Part(1) = Top
        Part(2) = Middle
        Part(3) = Bottom
        Part(4) = TopRight
        Part(5) = BottomRight
        Part(6) = TopLeft
        Part(7) = BottomLeft
        'All the labels have been assigned to a variable so we don't need to type out the whole name

        LCDoff = Color.DimGray
        LCDon = Color.Lime
        'These colors have been stored in the variables so we can just type the variable

        Call Reset()
        'Only the code in the this sub will run unless we tell it to start another sub
        'Now the code in the sub 'Reset' will run, the order the subs are in does not matter

    End Sub

    Private Sub Reset()

        'this function is call a 'for to next loop'
        For x As Integer = 1 To 7
            Part(x).BackColor = LCDoff
            'it will do this fuction each time and replace x with the numbers 1 to 7
            'so...
            'Part(1).BackColor = LCDoff
            'Part(2).BackColor = LCDoff
            'Part(3).BackColor = LCDoff etc...
        Next

    End Sub

    Private Sub Allon()

        For x As Integer = 1 To 7
            Part(x).BackColor = LCDon
            'this does the same as before but instead changes the color to LCDon which is lime
        Next

    End Sub

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

        Call Reset()
        'every time a new number is pressed we want to have a blank canvas so labels are not left on from the previous number

        Part(4).BackColor = LCDon
        Part(5).BackColor = LCDon
        'then we turn on the labels we need to show the number 1

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        Call Allon()
        'here we do the opposite so there is less code we need to type
        'turn them all on then turn of the labels we don't need

        Part(5).BackColor = LCDoff
        Part(6).BackColor = LCDoff

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        Call Allon()

        Part(6).BackColor = LCDoff
        Part(7).BackColor = LCDoff

    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

        Call Allon()

        Part(1).BackColor = LCDoff
        Part(3).BackColor = LCDoff
        Part(7).BackColor = LCDoff

    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

        Call Allon()

        Part(4).BackColor = LCDoff
        Part(7).BackColor = LCDoff

    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click

        Call Allon()

        Part(4).BackColor = LCDoff

    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click

        Call Reset()

        Part(1).BackColor = LCDon
        Part(4).BackColor = LCDon
        Part(5).BackColor = LCDon

    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click

        Call Allon()

    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click

        Call Allon()

        Part(7).BackColor = LCDoff

    End Sub

    Private Sub Button0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button0.Click

        Call Allon()

        Part(2).BackColor = LCDoff

    End Sub

    Private Sub btnReset_Click(sender As System.Object, e As System.EventArgs) Handles btnReset.Click

        Call Reset()

    End Sub
End Class