A list box control is the way to go in Visual Basic if you're going to display many items for the user to select. The problem is for the user when they need to select 90 percent of the items, which can be time consuming. The best method is to pre-select all the items for the user and let them unselect the ones they don't need. In VB, the "Items" property allows you obtain a reference to all the items in the control that you can use to select them.
Launch Microsoft Visual Basic Express, click "New Project ..." on the left pane of your screen, and double-click "Windows Forms Application" to start a new project.
Double-click "ListBox" on the Toolbox pane to add a new list box control. Add a button by double-clicking "Button" on the toolbox.
Right-click the list box control and click "Properties." Scroll down until you reach SelectionMode and set it to "MultiSimple."
Double-click the form to create a form load event and add the following code to add five items to the list box:
Double-click "Button1" to create a click event for the button. Type the following code to select all the items in the list box control:
Dim itmCntr As Integer
For itmCntr = 0 To Me.ListBox1.Items.Count - 1
Press "F5" to run the program and click "Button1" to select all the items.
- Photo Credit Ryan McVay/Photodisc/Getty Images
How to Create a File List Box in Visual Basic
An interface you create using Visual Basic can require or allow the user to select a file from the computer's hard drive....
Visual Basic 6.0 Database Tutorial
Database programming using Visual Basic 6.0 relies on the ADO (ActiveX Data Objects) Object Model architecture. This is a less complicated architecture...
How to Use a Listbox Control in MFC Visual C++
A list box is a Windows control that can display text or iconic items as a list of rows. The Microsoft Foundation...
How to Delete All Items Inside of a List Box in Visual Basic
List boxes are components used in Web and desktop forms. You can add, remove and edit the content contained in the list...
How to Create a Listbox in VB From an Excel Spreadsheet
A listbox can allow users to select data from a list for entry into a particular cell. For example, to enter data...