BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to Use TDBCombobox

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop)
View previous topic :: View next topic  
Author Message
Bill N
Guest





PostPosted: Thu Jan 29, 2004 2:24 pm    Post subject: How to Use TDBCombobox Reply with quote




I want to list the descriptor field but return the index field of the selected item in a combobox. Is there a way of doing this with a TDBCombobox?

I could iterate through the query and add items to a TCombobox and use AddObject to add the integer key and on the selected item I could retrieve that value but isn't there an easier way.

Thanks,
Bill N
Back to top
JohnE
Guest





PostPosted: Thu Jan 29, 2004 11:19 pm    Post subject: Re: How to Use TDBCombobox Reply with quote



Quote:
I want to list the descriptor field but return the index field of the
selected item in a combobox. Is there a way of doing this with a

TDBCombobox?

I use a TDBLookupComboBox to do as you describe. Set the ListSource,
ListField and Keyfield properties. To check which keyvalue has been
selected simply read the DbLookupCombobox.Keyvalue property. The control
does not need to be bound to a Datasource or Datafield in order to work.
This will work provided your key value is in the same table as your
description field.

HTH,

John



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.