Page 76 - Open Soource Technologies 304.indd
P. 76
Event Driven Programming
How to use ComboBox in visual basic?
The ComboBox is called that because it's a combination of a ListBox and a Textbox. It has the
advantage over the ListBox of not taking up space until it is actually used which means that
it makes it easier to position on the Form.
But the combo has the disadvantage, sort of, that the user can enter his own information, in
addition to what is in the list. This may make data validation harder because the choices are
not limited. When you want to force the user to make a choice only among the specified
items, use a ListBox, even if it is a bit more awkward. If the user is allowed to override the
choices, uses a ComboBox.
As in the ListBox, use the Text property to get the information input.
Label3.Caption = cbo_position.Text
70 LOVELY PROFESSIONAL UNIVERSITY