I am making a resturant menu in visual basic/studio 2012.
I am supposed to make the groups be visible and invisible if their checkboxes are checked or not.
Also I cannot make it compute anything except the first group.
This is the code I have made so far and the two errors I get:
Public Class frmMenu
Private Sub chkBurgers_CheckedChanged(sender As Object, e As EventArgs)
Handles chkBurgers.CheckedChanged
If chkBurgers.Checked Then
grpBurgers.Visible = True
Else
grpBurgers.Visible = False
End If
End Sub
Private Sub chkFries_CheckedChanged(sender As Object, e As EventArgs) Handles chkFries.CheckedChanged
If chkFries.Checked Then
grpFries.Visible = True
Else
grpFries.Visible = False
End If
End Sub
Private Sub chkDrinks_CheckedChanged(sender As Object, e As EventArgs) Handles chkDrinks.CheckedChanged
If chkDrinks.Checked Then
grpDrinks.Visible = True
Else
grpDrinks.Visible = False
End If
End Sub
Private Sub btnCompute_Click(sender As Object, e As EventArgs) Handles btnCompute.Click
Dim sum As Double
If chkBurgers.Checked Then
If radRegular.Checked Then
sum += 4.19
ElseIf radCheese.Checked Or radBacon.Checked Then
sum += 4.79
ElseIf radBaconandCheese.Checked Then
sum += 5.39
End If
End If
If chkFries.Checked Then
If radSmall.Checked Then
sum += 2.39
ElseIf radMedium.Checked Then
sum += 3.09
ElseIf radLarge.Checked Then
sum += 4.99
End If
End If
If chkDrinks Then
If radSoda.Checked Then
sum += 1.69
ElseIf radBottledWater Then
sum += 1.49
End If
End If
txtCost.Text = sum.ToString("C")
End Sub
End Class
Also I recieved two errors which are:
1 Value of type 'System.Windows.Forms.CheckBox' cannot be converted to 'Boolean'. C:\Vis2012\Resturant Menu\Resturant Menu\frmMenu.vb Resturant Menu
2 Value of type 'System.Windows.Forms.RadioButton' cannot be converted to 'Boolean'. C:\Vis2012\Resturant Menu\Resturant Menu\frmMenu.vb Resturant Menu