Lazarus

Programming => Databases => Topic started by: james on February 22, 2011, 05:36:05 am

Title: DBLookuPComboBox or....
Post by: james on February 22, 2011, 05:36:05 am
I'd like to use the subject to add the content of the listsource field to an edit box.  There is no datasource/datafield used.
"Caption" isn't the answer.  DBLookuPComboBox.KeyField doesn't work.  All I get is a field name.  What does one use?
Title: Re: DBLookuPComboBox or....
Post by: sorinr on February 22, 2011, 07:13:21 am
Hi James,

Something like edit1.text:=dblookupcombobox1.ListSource.Name ?

Regards
Title: Re: DBLookuPComboBox or....
Post by: james on February 22, 2011, 07:53:24 am
Thanks for the answer, but that just displays the datasource name...

Title: Re: DBLookuPComboBox or....
Post by: sorinr on February 22, 2011, 09:08:26 am
Do you need the selected value of the combo displayed in an editbox?
If yes: edit.text:=combo.text; with the code on combo's 'on change' event.
Title: Re: DBLookuPComboBox or....
Post by: james on February 22, 2011, 05:49:38 pm
That displays the Listfield content.  That isn't what I want, but thanks for the answer.

I think I need to clarify what I am trying to do.

The combobox uses a ListField called prov_name and this is a lookup list of province and state names.

The KeyField is called prov_code and is a lookup list of province and state abbreviations.

So, if the province name is 'British Columbia', and I click on British Columbia, the edit box needs to contain 'BC'.

Similarly, if the state is California, 'CA' needs to appear in the edit box.
Title: Re: DBLookuPComboBox or....
Post by: james on February 23, 2011, 12:28:15 am
Problem solved.

One query to populate the combobox and one more to populate the edit box using the combobox caption.  Painful compared to another Pascal offering.............
TinyPortal © 2005-2018