Question posted 2011 · +4 upvotes
i’m loading huge database from excel (about 2000 items) to combobox. For example CD titles. Then i select 1 CD title from this 2000. I’d like to use here autocomplete, but i don’t know how..
// Loading items from Excel
for (rCnt = 2; rCnt <= range.Rows.Count; rCnt++)
{
for (cCnt = 1; cCnt < 2; cCnt++)
{
str = Convert.ToString(saRet[rCnt,cCnt]);
// Loading items to ComboBox
ReferenceCombo.Items.Add(str);
}
Accepted answer +20 upvotes
On your form, you need to set two properties for your ComboBox:
AutoCompleteMode should be Suggest, Append, or SuggestAppend. I recommend SuggestAppend.
AutoCompleteSource should be ListItems.
Excel VBA objects referenced (4)
ReferenceCombo.Items— Allow users to add items to an unbound combo boxReferenceCombo.Items— Categorize Your Outlook ItemsRows.Count— Count function (Microsoft Access SQL)Rows.Count— Count the number of records in a DAO Recordset
Top excel Q&A (6)
- Shortcut to Apply a Formula to an Entire Column in Excel +335 (2011)
- How should I escape commas and speech marks in CSV files so they work in Excel? +136 (2012)
- Convert xlsx to csv in linux command line +96 (2012)
- How to create a link inside a cell using EPPlus +50 (2011)
- IF statement: how to leave cell blank if condition is false ("" does not work) +44 (2013)
- T-SQL: Export to new Excel file +44 (2012)
excel solutions on this site
— top 17%.