Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DBComboBox and Name-Value combinations 1

Status
Not open for further replies.

fluke030

Programmer
Nov 25, 2005
8
US
Hello,

In the app we are designing at work, we have a situation where we cannot use the typical DBLookupCombo component, yet it's close to what we need. We need to store a code but display a description. There is a similar question in this forum regarding DBCombos and enumerated integers. That is very close to working for us. Problem is that some of the values to store are non-sequential. They may be like this:

<Blank>=0
InformationProvided=5
InformationRefused=6

These values are provided from a query.

In the question I found earlier, this code is used: [dbComboBox].Items.IndexOf(text);

Is there some way to use a name-value pair inside a DBComboBox so that the associated value hangs around with the text? Doesn't have to be displayed. In fact, can't be displayed. Any thoughts?

Frank
 
MyComboBox.Items.Objects[n] as usual while using TStrings?

You can typecast the pointer to hold an integer or hang a TObject to hold a more complex code (don't forget to free the object while reloading/freeing the DBCombo).

buho (A).
 
there are combos at
TDBValComboBox is a descendent of TDBCombobox that allows to add a list of values. So it's possible to select a string in the combobox and save a different value
( maybe a number ) to the Database.


Aaron Taylor
John Mutch Electronics
 
There is a FAQ about How to use Look Up fields with Tables /Queries
faq102-1212


Steven
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top