Objective: To learn to
use list boxes and arrays.
Problem description:
To create a phone book (like the one below) that can perform the following functions:
1. Add/Update: The user enters a name
(necessary) and a phone number (not necessary) and clicks Add/Update to
add/update the entry in the phone book. Condition: The name cannot be an
empty string “”.
2. Search : The user enters a name and
clicks Search to search for the telephone number corresponding to the name. Conditions: If there is a telephone number corresponding
to the name, then it is displayed in the Tel No textbox. If the name is found
but there is no corresponding phone number a message “Number unknown” is displayed
else if the name is not found in the phone book, a message “No such entry” is
displayed.
3. Clicking on an entry in the list box should
display that entry in the name textbox and clear the tel no text box.
Object Type |
Object Name |
Function |
Label |
LblName |
Displays “Name” |
Label |
LblTel |
Displays “Tel No” |
Textbox |
TxtName |
Takes the name input from the user |
Textbox |
TxtTel |
Takes the tel no from the user |
Button |
BtnSearch |
When clicked, searches for the tel no corresponding
to the name in txtName |
Button |
BtnAddUpdate |
Adds/Updates the phone book with the entry
provided by the user |
Listbox |
ListNames |
Displays the list of all the names in the
phone book currently. |