Block of Code

Practical Examples for Programmers

  • Home
  • C++
  • Java
  • Visual Basic
  • Discrete Math
  • Ask a Question

Maintain a List

Write a program that contains a list box (with Sorted = False), a label, and two buttons captioned Add an Item and Delete an Item. When the Add an Item button is clicked, the program should request an item with an input dialog box and then insert the item above the currently highlighted item. When the Delete an Item button is clicked, the program should remove the highlighted item from the list. At all times, the label should display the number of items in the list.  See the figure below.

Maintain a List Screenshot
Suggested Control Names and Attributes:

Name Property Text Property Control Type Notes
 frmMaintain Maintain a List Form Holds Controls
 lstOutput ListBox Displays List
 btnAdd Add an Item Button Triggers event to add an item to the list
 btnDelete Delete an Item Button Triggers event to delete an item from the list
 lblNumberOfItems Label Display the number of items on the list

Secondary Sidebar

This is the secondary sidebar

Copyright © 2025 · Metro Pro Theme on Genesis Framework · WordPress · Log in