Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 2.36 KB

when-to-use-a-windows-forms-combobox-instead-of-a-listbox.md

File metadata and controls

30 lines (25 loc) · 2.36 KB
title description ms.date helpviewer_keywords ms.assetid
ComboBox vs. ListBox
Learn about using Windows Forms ComboBox and Windows Forms ListBox, and learn to how tell when one or the other is more appropriate for a task.
03/30/2017
ListBox control [Windows Forms], adding and removing items
ListBox control [Windows Forms], vs. ComboBox
bound controls [Windows Forms], combo boxes
Windows Forms controls, data binding
ComboBox control [Windows Forms], compared to ListBox
combo boxes [Windows Forms], compared to list boxes
ListBox control [Windows Forms], accessing items
ListCount property
7bcaea58-1cfa-46db-9baf-b75a69d8f9ec

When to Use a Windows Forms ComboBox Instead of a ListBox

The xref:System.Windows.Forms.ComboBox and the xref:System.Windows.Forms.ListBox controls have similar behaviors, and in some cases may be interchangeable. There are times, however, when one or the other is more appropriate to a task.

Generally, a combo box is appropriate when there is a list of suggested choices, and a list box is appropriate when you want to limit input to what is on the list. A combo box contains a text box field, so choices not on the list can be typed in. The exception is when the xref:System.Windows.Forms.ComboBox.DropDownStyle%2A property is set to xref:System.Windows.Forms.ComboBoxStyle.DropDownList. In that case, the control will select an item if you type its first letter.

In addition, combo boxes save space on a form. Because the full list is not displayed until the user clicks the down arrow, a combo box can easily fit in a small space where a list box would not fit. An exception is when the xref:System.Windows.Forms.ComboBox.DropDownStyle%2A property is set to xref:System.Windows.Forms.ComboBoxStyle.Simple: the full list is displayed, and the combo box takes up more room than a list box would.

See also