Programming GUI 1

Topic Progress


You need:

  • 3 CheckBoxes labelled as above
  • 2 Labels
  • 1 Button

Click on the button and paste the following code

1
2
3
4
5
6
7
8
total = 0
        Label1.Text = 0
        If CheckBox1.CheckState = 1 Then
            findTotal(2.0)
        End If
        If CheckBox2.CheckState = 1 Then
            findTotal(4.0)
        End If

At the top paste this code (see image of code below)

1
 Dim total As Decimal = 0

Click on the form and under the “Class Form1” paste the following function (refer to image of code below)

1
2
3
4
5
Private Function findTotal(ByVal num1 As Integer)
     total = total + num1
     Label1.Text = total
     Return total
End Function

All of the code