[dba-VB] Combo box

JWColby jwcolby at colbyconsulting.com
Sat Apr 28 01:05:44 CDT 2007


Many years ago I designed (in Access) a text box / list box pair of controls
to emulate a combo box.  The idea was to take each character in the text box
and use the characters to narrow down the remaining values displayed in the
list.  IOW filter a query over and over as more characters were typed in the
text box.

In order to make it look like a combo, I created a list box, positioned it
under the text box, shrank the vertical size up to a single line and the
width to the same width as the text box.  When the user clicked in the text
box I dropped down the list (expanded it vertically and horizontally) and
displayed the entire list.  As the user typed characters I requeried the
list, with fewer and fewer remaining records being displayed.  If the user
deleted characters I also requeried the list.  When the user had selected
the correct data and left the text box, the OnExit resized the list to a
single line / same width as the text box.  It worked quite well.

Do you think a strategy such as this could be used to implement an "access
type" combo box substitute.  It wasn't an exact duplicate of the combo
functionality but it did work and was easy to implement.

John W. Colby
Colby Consulting
www.ColbyConsulting.com

-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of JWColby
Sent: Saturday, April 28, 2007 1:35 AM
To: dba-vb at databaseadvisors.com
Subject: [dba-VB] Combo box

I am running into the issue of how to display multiple lines in a combo box.
IIRC this is a "no can do" in the combos in VB.Net but there must be common
workarounds.  
 
For example I need to allow the user to select a zip code, but he really
needs to see the zip AND the city.  Furthermore my code is going to need to
load a record based on that zip code to get lat/long.
 
So, is there a way other than using a concatenation of the zip and the city
to display both in the combo?  If I do a concatenation, then I can no longer
use the zip to lookup a record in a recordset since it now has city data in
the string.
 
John W. Colby
Colby Consulting
www.ColbyConsulting.com
 
_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com




More information about the dba-VB mailing list