A
ComboBox control is a combination of a TextBox and a ListBox control.
Only one list item is displayed at one time in a ComboBox and other
available items are loaded in a drop down list.
Creating a Combo Box:
We can create a ComboBox control using a Forms designer at design-time or using the ComboBox class in code at run-time.
To
create a ComboBox control at design-time, you simply drag and drop a
ComboBox control from Toolbox to a Form in Visual Studio. After you drag
and drop a ComboBox on a Form, the ComboBox looks like Figure 1. Once a
ComboBox is on the Form, you can move it around and resize it using
mouse and set its properties and events.
A list box is a GUI widget that allows the user to select one or more items from a list contained within a static, multiple line text box. The user clicks inside the box on an item to select it, sometimes in combination with the Shift key or Control key[1] in order to make multiple selections. "Control-clicking" an item that has already been selected, unselects it.
Setting ComboBox Properties:
After you place a Combo Box control on a Form, the next step is to set properties.
The
easiest way to set properties is from the Properties Window. You can
open Properties window by pressing F4 or right click on a control and
select Properties menu item. The Properties window looks like Figure 2.
No comments:
Post a Comment