Spread Windows Forms 6.0 Product Documentation
AutoSearch Property
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread.CellType Namespace > ComboBoxCellType Class : AutoSearch Property


Glossary Item Box

Gets or sets how a list of items in a combo box is searched based on input of a character key.

Syntax

Visual Basic (Declaration) 
Public Property AutoSearch As AutoSearch
Visual Basic (Usage)Copy Code
Dim instance As ComboBoxCellType
Dim value As AutoSearch
 
instance.AutoSearch = value
 
value = instance.AutoSearch
C# 
public AutoSearch AutoSearch {get; set;}

Property Value

AutoSearch setting that determines how the list items are searched

Remarks

This property allows the user to type one or more characters to scroll to an item in the list of a combo box.

When set, the control automatically searches through the items in the drop-down list for an item that matches the user input based on the setting for the search. For example, if you set it to single character, it finds the item based on the first character the user types. When it finds a matching item, it scrolls to that item and places that value in the cell. Refer to the FarPoint.Win.AutoSearch enumerations for more details on the possible settings for this property. Typing a character initiates a search for the first item that begins with that character. If the item found is not visible in the list, the control scrolls to the first item that matches that character or characters. The control highlights the found item.

The search is case insensitive.

If the search character is not found and the setting is SingleCharacter, no item is highlighted.

If the setting is MultipleCharacter, the selection highlighting moves to the closest available match for the search string as the characters are entered (for example, to highlight "Variegated" type "var"). If none of the items begin with the first character entered, the control does not scroll the list.

If the setting is SingleGreaterThan, the control highlights the next greater item if the search character is not found. For example, the first item starting with the letter "g" will be highlighted if the user searched for the letter "f" and none of the items begin with "f". If there is a match, and you type the key repeatedly, the search iterates through all the items that match.

For example, assume the control displays five rows and this property is set to MultipleCharacter. List item "Willow Springs" is in row 10 and "Wilmington" is in row 20. When you type the letter "w", the list scrolls to "Willow Springs". When you type the letters "i" and then "l", nothing changes. If the fourth letter you type is "m", the list will scroll to "Wilmington". If the fourth letter you type is "z" (no match is found), the list scrolls so that the first row is the top row in the list.

Example

This example sets up a cell on the first sheet with a combo box with the first six months of the year and specifies the size of the portion displayed.
C#Copy Code
FarPoint.Win.Spread.CellType.ComboBoxCellType cmbocell = new FarPoint.Win.Spread.CellType.ComboBoxCellType();
cmbocell.Items = (new String[] {"January", "February", "March", "April", "May", "June"});
cmbocell.AcceptsArrowKeys = FarPoint.Win.SuperEdit.AcceptsArrowKeys.AllArrows;
cmbocell.AutoSearch = FarPoint.Win.AutoSearch.SingleCharacter;
cmbocell.Editable = true;
cmbocell.ListAlignment = FarPoint.Win.ListAlignment.Left;
cmbocell.ListOffset = 20;
cmbocell.ListWidth = 0;
cmbocell.MaxDrop = 4;
fpSpread1.Sheets[1].Cells[2,2].CellType = cmbocell;
Visual BasicCopy Code
Dim cmbocell As New FarPoint.Win.Spread.CellType.ComboBoxCellType()
cmbocell.Items = (new String() {"January", "February", "March", "April", "May", "June"})
cmbocell.AcceptsArrowKeys = FarPoint.Win.SuperEdit.AcceptsArrowKeys.AllArrows
cmbocell.AutoSearch = FarPoint.Win.AutoSearch.SingleCharacter
cmbocell.Editable = True
cmbocell.ListAlignment = FarPoint.Win.ListAlignment.Left
cmbocell.ListOffset = 20
cmbocell.ListWidth = 0
cmbocell.MaxDrop = 4
fpSpread1.Sheets(1).Cells(2,2).CellType = cmbocell

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

© 2002-2012 ComponentOne, a division of GrapeCity. All Rights Reserved.