Library tutorials & articles
ListBox Control
Adding Items
To add an item to a listbox during design time, select the Items property box, and press the drop down button. Enter the items you want to be displayed. Press Ctrl+Return to insert another item. Press Return to apply the changes, Esc to cancel
To add an item to a listbox during runtime, you can use the following syntax:
List1.AddItem Item, Index
where Item is a string containing the text to be displayed for that item. Index is an optional value to identify that item. You can only use a valid value. For example:
List1.AddItem "David", 4
is only valid if the list already has 4 items (remember the index starts from 0) If omitted, a default value is added. (0 is the first item on the list, 1 the second and so on). The following code adds three items to a combo box: David, Paul and Sarah.
List1.AddItem "David"
List1.AddItem "Paul"
List1.AddItem "Sarah"
Related articles
Related discussion
-
Run-time error '91'
by converter2009 (1 replies)
-
VB6 Runtime error 381 subsript out of range Error
by Uncle (2 replies)
-
passing and reading parameters from using Shell
by jigartoliya (0 replies)
-
Convert C++ code to VB6
by mawcot (4 replies)
-
listbox scrollbar
by Dennijr (10 replies)
Related podcasts
-
Christian Beauclair
14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...
Suppose I have numeric values in my listbox. How do I add them and display the result on a message box.
This thread is for discussions of ListBox Control.