static string[] x = { "Afghanistan", "Afgff", "Albania", "Bahrain", "Bhutan", "Cambodia", "Denmark",
"Egypt", "Finland", "Guyana", "Guinea", "Haiti", "Iceland", "Ireland", "Jamaica", "Jordan" };
ArrayList flist = new ArrayList(x);
public Form1()
{
InitializeComponent();
this.cbxList.DropDownStyle = ComboBoxStyle.DropDown;
this.cbxList.Items.AddRange(x);
this.cbxList.AutoCompleteSource = AutoCompleteSource.ListItems;
this.cbxList.AutoCompleteMode = AutoCompleteMode.Suggest;
}
Breakdown of the ComboBox settings with help from MSDN
this.cbxList.DropDownStyle = ComboBoxStyle.DropDown;http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.dropdownstyle.aspx
The DropDownStyle property specifies whether the list is always displayed or whether the list is displayed in a drop-down. That is, the different styles allowed are,
- Simple - list has no drop down arrow, text editable
- DropDown - list displayed by clicking down arrow and text is editable
- DropDownList - Similiar to DropDown but text is not editable
this.cbxList.Items.AddRange(x);This just adds array of items to the ComboBox. http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.objectcollection.addrange.aspx
this.cbxList.AutoCompleteSource = AutoCompleteSource.ListItems;Gets or sets a value specifying the source of complete strings used for automatic completion. http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox.autocompletesource.aspx. Values available are,
- FileSystem
- HistoryList
- RecentlyUsedList
- AllUrl
- AllSystemSources
- FileSystemDirectories
- CustomSource
- None
- ListItems
this.cbxList.AutoCompleteMode = AutoCompleteMode.Suggest;Type of auto complete available
- None
- Suggest - filter appears at drop down
- Append - just appends the most likely string to the text
- SuggestAppend - Suggests AND Append
No comments:
Post a Comment