100% found this document useful (1 vote)
124 views2 pages

Topic3 1

The document describes building a pizza ordering application that allows users to select different pizza types using radio buttons. When a pizza type is selected, the corresponding checkboxes for ingredients are automatically checked and the price is displayed. It involves creating radio buttons for pizza types (Deluxe, Special, Primo), checkboxes for ingredients, a textbox to display the price, and code behind each radio button to programmatically check ingredients and set the price when that pizza is selected.

Uploaded by

Joe Han
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
124 views2 pages

Topic3 1

The document describes building a pizza ordering application that allows users to select different pizza types using radio buttons. When a pizza type is selected, the corresponding checkboxes for ingredients are automatically checked and the price is displayed. It involves creating radio buttons for pizza types (Deluxe, Special, Primo), checkboxes for ingredients, a textbox to display the price, and code behind each radio button to programmatically check ingredients and set the price when that pizza is selected.

Uploaded by

Joe Han
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Additional Example

Using Radio buttons and Check boxes together


Example 3:
Design and develop a simple application system that when the user chooses the Deluxe pizza option, the
ingredients to be checked are: Cheese, Bacon and Ham, and Onion and Chili; its corresponding price is 185
pesos (to be displayed at the text box). When the user chooses the Special pizza option, the ingredients
to be checked are: Cheese, Pepper, Bacon and Ham, Mushroom, and Onions and Chili; its price is 250
pesos. Now if the user chooses the Primo pizza option, all ingredients should be marked with a check, and
its price is 290 pesos.

1. Create a new Windows Form Application project. Name the new application system
vbPizza1. Set the Form’s Text Property to vbPizza1, too.
2. Add GroupBox into the Form and change its caption to “Pizza”, then put three Radio
buttons with captions: Deluxe, Special and Primo. Next, add another GroupBox with a
caption “Ingredients”, then put seven Check boxes on it and name the Check Boxes
captions with these: Cheese, Pepper, Bacon and Ham, Mushroom, Onions and Chili,
Tomato and Pineapple and Salami.
3. Finally add a Text box and place it below the Pizza Frame. Then put a label at the top of it
with the word “Price”.

4. Double-click the Deluxe


(Radio button1) on the Form to display the
RadioButton1_CheckedChanged event method, embed the following lines of code (in
bold only) to the method:
Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles
RadioButton1.CheckedChanged
CheckBox1.CheckState = 0
CheckBox2.CheckState = 1
CheckBox3.CheckState = 0
CheckBox4.CheckState = 1
CheckBox5.CheckState = 1
CheckBox6.CheckState = 0
CheckBox7.CheckState = 0
TextBox1.Text = "185"
End Sub
5. Double-click the Special
(Radio button2) on the Form to display the
RadioButton2_CheckedChanged event method, embed the following lines of code (in
bold only) to the method:
Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles
RadioButton2.CheckedChanged
CheckBox1.CheckState = 1
CheckBox2.CheckState = 1
CheckBox3.CheckState = 1
CheckBox4.CheckState = 1
CheckBox5.CheckState = 1
CheckBox6.CheckState = 0
CheckBox7.CheckState = 0
TextBox1.Text = "250"
End Sub
6. Double-click the Deluxe
(Radio button3) on the Form to display the
RadioButton3_CheckedChanged event method, embed the following lines of code (in
bold only) to the method:
Private Sub RadioButton3_CheckedChanged(sender As Object, e As EventArgs) Handles
RadioButton3.CheckedChanged
CheckBox1.CheckState = 1
CheckBox2.CheckState = 1
CheckBox3.CheckState = 1
CheckBox4.CheckState = 1
CheckBox5.CheckState = 1
CheckBox6.CheckState = 1
CheckBox7.CheckState = 1
TextBox1.Text = "290"
End Sub
7. Build and execute the application system.
Sample Output:

You might also like