0% found this document useful (0 votes)
6 views3 pages

Worksheet 12

The document outlines instructions for creating forms with ListBox controls, focusing on properties, methods, and events. It includes tasks such as modifying selection modes, displaying selected items and indices, and implementing buttons for adding, removing, and clearing items. Additionally, it describes exercises for moving items between two ListBoxes and handling user selections with specific messages.

Uploaded by

Ahmed Al-nasheri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Worksheet 12

The document outlines instructions for creating forms with ListBox controls, focusing on properties, methods, and events. It includes tasks such as modifying selection modes, displaying selected items and indices, and implementing buttons for adding, removing, and clearing items. Additionally, it describes exercises for moving items between two ListBoxes and handling user selections with specific messages.

Uploaded by

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

Work Sheet 12

ListBoxes

First: Review listBox control item and its main properties, methods and
default event.

Create the following form, and add a Listbox with the following items in it:

- Review the property SelectionMode and change its value (One,


MultiSimple, MultiExtended)
- Change the property Sorted into True, and check the effect.
- Add two labels to the form.
- In the first label, display the selectedItem (use the default event
SelectedIndexChanged).
- In the second label, display the selectedIndex. (check its value when no
items are selected)
- Discuss the properties SelectedItems and SelectedIndecies.
- If a user selects either C++ or C#, display a message "Welcome to C
languages". (hint: use method GetSelected)
- Add a button labeled "Count" and another label. When pressing the
button, display number of items in the listbox in the new label.
Second: Practice several actions on the listBox.

Create the following form:

Activate the displayed buttons as follows:

1. Add: Adds the item entered in the textbox into the listbox.
2. Remove: Removes the selected item in the listbox (Ex: Change it to
remove the written item in the textbox).
3. Clear List: Clears/removes all items in the listbox
4. Clear Selected: Removes the selection on items in the listbox.
Exercise 5:

Create the following form:

Activate the displayed buttons, so that:

1. > : moves the selected item from left listbox to the right one.
2. <: moves the selected item from right listbox to the left one
3. >>: moves all items from left listbox to the right one.
4. <<: moves all items from right listbox to the left one.

Change the code in > and < buttons, so that they move the selected
items.

You might also like