We used radio buttons and check boxes to illustrate Boolean expressions
Public Class Form1 Dim basePrice As Double = 0 Dim smallPrice As Double = 5.5 Dim mediumPrice As Double = 8 Dim largePrice As Double = 12 Private Sub PizzaSizedChanged(sender As Object, e As EventArgs) _ Handles RadSmall.CheckedChanged, RadMedium.CheckedChanged, _ RadLarge.CheckedChanged, ChkAnchovies.CheckedChanged, ChkPepperoni.CheckedChanged Dim size As String = "" If Me.RadSmall.Checked Then basePrice = smallPrice size = "small" End If If Me.RadMedium.Checked Then basePrice = mediumPrice size = "Medium" End If If Me.RadLarge.Checked Then basePrice = largePrice size = "Large" End If If Me.ChkAnchovies.Checked Then basePrice += 1 If Me.ChkPepperoni.Checked Then basePrice += 1 Me.Text = size & " will cost $" & basePrice End Sub End Class ________________________________________________________________ 'Alternate method: Public Class Form1 Dim basePrice As Double = 0 Private Sub PizzaSize1(sender As Object, e As EventArgs) If sender.text = "Small" Then basePrice = 5.0 If sender.text = "Medium" Then basePrice = 8.0 If sender.text = "Large" Then basePrice = 12.0 Me.Text = sender.text & " is $" & basePrice End Sub Private Sub PizzaSize2(sender As Object, e As EventArgs) If sender.text = "Small" Then basePrice = 5.0 ElseIf sender.text = "Medium" Then basePrice = 8.0 Else basePrice = 12 End If Me.Text = sender.text & " is now $" & basePrice End Sub Private Sub PizzaSize3(sender As Object, e As EventArgs) basePrice = sender.tag 'the value in tag was set at design time Me.Text = sender.text & " is really $" & basePrice End Sub Private Sub PizzaSize4(sender As Object, e As EventArgs) _ Handles RadLarge.CheckedChanged, RadSmall.CheckedChanged, _ RadMedium.CheckedChanged Dim size As String = sender.text Select Case size Case "Small" basePrice = 5.5 Case "Medium" basePrice = 8.99 Case "Large" basePrice = 13 End Select Me.Text = sender.text & " is really $" & basePrice End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) _ Handles MyBase.Load Me.RadSmall.Tag = 5.25 Me.RadMedium.Tag = 8.5 Me.RadLarge.Tag = 12.99 End Sub End Class