ToolStripComboBox.AutoCompleteCustomSource Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets the custom string collection to use when the AutoCompleteSource property is set to CustomSource.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

[BrowsableAttribute(true)]
public AutoCompleteStringCollection AutoCompleteCustomSource { get; set; }

Use the AutoCompleteCustomSource, AutoCompleteMode, and AutoCompleteSource properties to create a ToolStripComboBox that automatically completes input strings by comparing the prefix being entered to the prefixes of all strings in a maintained source. This is useful for ToolStripComboBox controls in which URLs, addresses, file names, or commands will be frequently entered.

The use of the AutoCompleteCustomSource property is optional, but you must set the AutoCompleteSource property to CustomSource in order to use AutoCompleteCustomSource.

You must use the AutoCompleteMode and AutoCompleteSource properties together.

The following code example demonstrates the syntax for setting various ToolStripComboBox properties, including the AutoCompleteCustomSource property.

// The following code example demonstrates the syntax for setting
// various ToolStripComboBox properties.
// 
toolStripComboBox1.AutoCompleteCustomSource.AddRange(new string[] {
"aaa",
"bbb",
"ccc"});
toolStripComboBox1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
toolStripComboBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
toolStripComboBox1.DropDownHeight = 110;
toolStripComboBox1.DropDownWidth = 122;
toolStripComboBox1.FlatStyle = System.Windows.Forms.FlatStyle.Standard;
toolStripComboBox1.IntegralHeight = false;
toolStripComboBox1.Items.AddRange(new object[] {
"xxx",
"yyy",
"zzz"});
toolStripComboBox1.MaxDropDownItems = 9;
toolStripComboBox1.MergeAction = System.Windows.Forms.MergeAction.Insert;
toolStripComboBox1.Name = "toolStripComboBox1";
toolStripComboBox1.Size = new System.Drawing.Size(121, 25);
toolStripComboBox1.Sorted = true;

.NET Framework
Available since 2.0
Return to top
Show: