Exploring Radio Buttons and Checkboxes in Visual Basic
Introduction: In Visual Basic, user interfaces play a crucial role in
SECTION: _________ DATE:_________ SCORE: ____
application development. Two commonly used elements for user
input are radio buttons and checkboxes. These controls are
Lastname: _____________ Firstname: ______________
instrumental in collecting user preferences, making choices, and PART I. Using the internet, look for the images of the
providing a more interactive user experience. radio button and textbox, and draw the icons on the
provided boxes and differentiate. (30pts)
Radio Buttons:
Radio buttons are used when there is a need for mutually exclusive Name of control: Name of control:
options. This means that selecting one radio button automatically
deselects others in the same group. They are particularly useful _____________________ _____________________
when users need to make a single choice from a set of options.
In VB, creating radio buttons involves placing them on a form and
grouping them together using the GroupBox control. This grouping
ensures that only one radio button within the same group can be
selected at a time.
Differentiate:
______________________________________________
______________________________________________
______________________________________________
______________________________________________
_________________________________________
Checkboxes:
PART II. Looking at the code below, try to understand
Checkboxes, on the other hand, allow users to make multiple and explain how it works. (30pts)
selections independently. They are ideal for situations where users
can choose from a list of options, and each option is independent of Code:
the others.
In VB, checkboxes are placed on a form like other controls, and their
state (checked or unchecked) can be easily accessed
programmatically.
______________________
______________________
______________________
______________________________________________
______________________________________________
______________________________________________
______________________________________________
______________________________________________
______________________________________________
_______________________________________
PART III. At the back of this paper, design/draw an
application where you can apply radiobutton and
checkboxes. Name your application and describe.
(30pts)
In Visual Basic, radio buttons and checkboxes are
fundamental to creating interactive and user-friendly
PART IV. Behavior – 20pts (Student teacher will answer
applications. Understanding their use, grouping, and this part)
event handling allows developers to build interfaces Score: _____/20
that cater to a variety of user input scenarios. By
effectively utilizing these controls, developers can Comments:
enhance the overall user experience of their ______________________________________________
applications ______________________________________________
___________________________________________
Signature: ________________ _________________
Example:
SECTION:___________ DATE: ___________ SCORE: ____________ SECTION:___________ DATE: ___________ SCORE: ____________
LAST NAME: _______________________________________________ LAST NAME: _______________________________________________
FIRST NAME: _______________________________________________ FIRST NAME: _______________________________________________
Directions: Encircle the correct answer: Directions: Encircle the correct answer:
1. What is the purpose of radio buttons in Visual Basic? 1. What is the purpose of radio buttons in Visual Basic?
A. Allowing multiple selections A. Allowing multiple selections
B. Collecting mutually exclusive options B. Collecting mutually exclusive options
C. Triggering events on user input C. Triggering events on user input
D. Grouping checkboxes together D. Grouping checkboxes together
2. How are radio buttons grouped in Visual Basic to achieve exclusivity? 2. How are radio buttons grouped in Visual Basic to achieve exclusivity?
A. Using the RadioGroup property A. Using the RadioGroup property
B. Placing them in a CheckboxGroup container B. Placing them in a CheckboxGroup container
C. Grouping them together with the GroupBox control C. Grouping them together with the GroupBox control
D. Assigning a unique name to each radio button D. Assigning a unique name to each radio button
3. When are checkboxes typically used in user interfaces? 3. When are checkboxes typically used in user interfaces?
A. When only one option is allowed A. When only one option is allowed
B. When mutually exclusive choices are required B. When mutually exclusive choices are required
C. For collecting multiple independent selections C. For collecting multiple independent selections
D. When creating radio button groups D. When creating radio button groups
4. Which control is used to respond to events when a checkbox's state 4. Which control is used to respond to events when a checkbox's state
changes in Visual Basic? changes in Visual Basic?
A. CheckEvent A. CheckEvent
B. StateChanged B. StateChanged
C. CheckChanged C. CheckChanged
D. CheckedChanged D. CheckedChanged
5. In the given code snippet, how are radio buttons assigned to the same 5. In the given code snippet, how are radio buttons assigned to the same
group? group?
' Grouping Radio Buttons ' Grouping Radio Buttons
RadioButton1.GroupName = "OptionsGroup" RadioButton1.GroupName = "OptionsGroup"
RadioButton2.GroupName = "OptionsGroup" RadioButton2.GroupName = "OptionsGroup"
RadioButton3.GroupName = "OptionsGroup" RadioButton3.GroupName = "OptionsGroup"
A. By using the Group property A. By using the Group property
B. Assigning the same name to each radio button B. Assigning the same name to each radio button
C. Utilizing the Grouping method C. Utilizing the Grouping method
D. Using the GroupName property D. Using the GroupName property
6. What is the primary characteristic of radio button options within the 6. What is the primary characteristic of radio button options within the
same group? same group?
A. They are mutually exclusive. A. They are mutually exclusive.
B. They allow multiple selections. B. They allow multiple selections.
C. They trigger events simultaneously. C. They trigger events simultaneously.
D. They must have the same name. D. They must have the same name.
7. Which scenario is checkboxes best suited for in a Visual Basic 7. Which scenario is checkboxes best suited for in a Visual Basic
application? application?
A. Collecting a single choice from multiple options A. Collecting a single choice from multiple options
B. Allowing users to choose only one option B. Allowing users to choose only one option
C. Enforcing mutually exclusive selections C. Enforcing mutually exclusive selections
D. Collecting multiple independent selections D. Collecting multiple independent selections
8. What property is used to set the text for a checkbox in Visual Basic? 8. What property is used to set the text for a checkbox in Visual Basic?
A. TextValue B. Label A. TextValue B. Label
C. Value D. Text C. Value D. Text
9. Which event is commonly used to handle changes in the state of a 9. Which event is commonly used to handle changes in the state of a
checkbox? checkbox?
A. StateChanged A. StateChanged
B. ValueChanged B. ValueChanged
C. CheckChanged C. CheckChanged
D. CheckedChanged D. CheckedChanged
10. Why is event handling important when working with checkboxes in 10. Why is event handling important when working with checkboxes in
Visual Basic? Visual Basic?
A. To create checkboxes dynamically A. To create checkboxes dynamically
B. To change the visual appearance of checkboxes B. To change the visual appearance of checkboxes
C. To respond to user input and perform actions C. To respond to user input and perform actions
D. To group checkboxes together D. To group checkboxes together