9.9. Use an Autocomplete Combo Box

Problem

You want to create a combo box that automatically completes what the user is typing based on the item list.

Solution

You can implement a basic autocomplete combo box by creating a custom control that overrides the OnKeyPress and OnTextChanged methods of the ComboBox object.

How It Works

An autocomplete control has many different variations. For example, the control may fill in values based on a list of recent selections (as Microsoft Excel does when you are entering cell values), or the control might display a drop-down list of near matches (as Microsoft Internet Explorer does when you are typing a URL). You can create a basic autocomplete combo box by handling the KeyPress and TextChanged events or ...

Get Visual Basic 2008 Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.