University of the East, Caloocan
NCP 413
AgentRook9192
Experiment #3: Advanced Windows Forms Controls
NAME
:
DATE:
STUDENT NUMBER:
... [Show More] INSTRUCTOR:
LEARNING OUTCOMES:
After completing this experiment the students will be able to:
1. Provide a list of options on a Windows Form by using a ListBox control, a ComboBox control, or a
CheckedListBox control.
2. Configure the layout and functionality of a Windows Form to display a list of items.
3. Implement value-setting controls on a Windows Form.
4. Configure a WebBrowser control.
5. Add and configure date-setting controls on a Windows Form.
6. Display images by using Windows Forms controls.
7. Configure the NotifyIcon component.
8. Create access keys for Windows Forms controls.
Experiment 3.A: Creating and Configuring List-Display Controls
A common scenario in user interface design is to present lists of data to users and to allow them to
select items from that list. Visual Studio provides several list-based controls that allow a variety of presentation
options. In this experiment, you will learn about the basic list-based controls, such as the ListBox, ComboBox,
and CheckedListBox, as well as more specialized list-based controls, such as ListView, TreeView,
NumericUpDown, and DomainUpDown. You will learn how to display lists and select items from lists.
Overview of List-Based Controls
The basic list-based controls are the ListBox, ComboBox, and CheckedListBox controls. Although
differing somewhat in appearance and functionality, each of these controls organizes and presents lists of data
in the same way, and each contains an Items collection that organizes the items contained in one of these
controls. The Items collection is basically a collection of objects. Although these objects are often strings, they
do not have to be. If a collection does contain a string, however, the string representation of the object is
displayed in the control.
ListBox Control
The ListBox control is the simplest of the list-based controls. It serves primarily to display a simple list of
items in an easy-to-navigate user interface. Users can select one or more items.
ComboBox Control
The ComboBox control is similar to the ListBox control, but, in addition to allowing the user to select
items from a list, it provides a space for a user to type an entry as well as select items from a list. Additionally,
you can configure the ComboBox either to display a list of options or to provide a drop-down list of options.
CheckedListBox Control
The CheckedListBox displays a list of items to users and allows them to select multiple items by
checking boxes that are displayed next to the items. Any number of items can be checked, but only one item
can be selected at a time. You can retrieve a collection that represents the checked items by accessing the
CheckedItems collection, and you can get a collection of the checked indexes by accessing the
CheckedIndices collection.
Adding Items to and Removing Items from a List-Based Control
You can add items to or remove items from a list-based control through either the Designer at design
time or code at run time. To add items to a list-based control at design time, you select the control in the
Designer and then, in the Properties window, select the Items property. The String Collection Editor (shown in
NCP 413 – Object-oriented Programming Laboratory | 1 [Show Less]