ComboBox

Jump to: navigation, search

The ComboBox control combines a ListBox control with a TextBox control.

Contents


Useful properties

  • AutoCompleteCustomSource - Defines a custom System.Collections.Specialized.StringCollection to use when the AutoCompleteSource property is set to CustomSource.
  • AutoCompleteMode - Defines an option that controls how automatic completion works for the ComboBox. Takes a value from the AutoCompleteMode enumeration:
  • Append - Appends the remainder of the most likely candidate string to the existing characters, highlighting the appended characters.
  • None - Disables the automatic completion feature for the ComboBox control. This is the default value of AutoCompleteMode.
  • Suggest - Displays the auxiliary drop-down list associated with the edit control. This drop-down is populated with one or more suggested completion strings.
  • SuggestAppend - Applies both Suggest and Append options.
  • AutoCompleteSource - Defines a value specifying the source of complete strings used for automatic completion. Takes a value from the AutoCompleteSource enumeration:
  • AllSystemSources - Specifies the equivalent of FileSystem and AllUrl as the source. This is the default value when AutoCompleteMode has been set to a value other than the default (None).
  • AllUrl - Specifies the equivalent of HistoryList and RecentlyUsedList as the source.
  • CustomSource - Specifies strings from a built-in AutoCompleteStringCollection as the source.
  • FileSystem - Specifies the file system as the source.
  • FileSystemDirectories - Specifies that only directory names and not file names will be automatically completed.
  • HistoryList - Includes the Uniform Resource Locators (URLs) in the history list.
  • ListItems - Specifies that the items of the ComboBox represent the source.
  • None - Specifies that no AutoCompleteSource is currently in use. This is the default value of AutoCompleteSource.
  • RecentlyUsedList - Includes the Uniform Resource Locators (URLs) in the list of those URLs most recently used.
  • DropDownHeight - Specifies the height in pixels of the drop-down portion of the ComboBox.
  • DropDownStyle - Specifies the style of the ComboBox. Takes a value from the ComboBoxStyle enumeration:
  • DropDown - The text portion is editable. The user must click the arrow button to display the list portion. This is the default style.
  • DropDownList - The user cannot directly edit the text portion. The user must click the arrow button to display the list portion. The list displays only if AutoCompleteMode is Suggest or SuggestAppend.
  • Simple - The text portion is editable. The list portion is always visible.
  • DropDownWidth - Specifies the width of the of the drop-down portion of a ComboBox.
  • DroppedDown - Indicates whether the ComboBox is displaying its drop-down portion.
  • MaxDropDownItems - Specifies the maximum number of items to be shown in the drop-down portion of the ComboBox.


Useful events

  • DropDown - Occurs when the drop-down portion of a ComboBox is shown.
  • DropDownClosed - Occurs when the drop-down portion of the ComboBox is no longer visible.


Displaying Items

When strings are added to the Items collection, a scroll bar is automatically added to the right hand side of the control.


Image:526-87.jpg



prevpp.png  nextpp.png
C# Online.NET