August 2003
Beginner to intermediate
600 pages
12h 57m
English
The ComboBox is ideal for applications in space-constrained environments, but the ListBox should be used if you have enough screen space to display several options to the user at once.
The ComboBox and ListBox share almost the same exact set of properties and methods. This includes the Items collection property and the Add, Remove, and Clear methods on the Items property. For example, the following code adds strings to a ListBox control at runtime. This code is nearly identical to the code used to add string to a ComboBox control.
C#
listBox1.Items.Add("Hi");
listBox1.Items.Add("Howdy");
listBox1.Items.Add("Wuz Up");
VB
listBox1.Items.Add("Hi")
listBox1.Items.Add("Howdy")
listBox1.Items.Add("Wuz Up")
You can also add ...
Read now
Unlock full access