Recent

Author Topic: DBLookUpComboBox KeyValue  (Read 16979 times)

99Percent

  • Full Member
  • ***
  • Posts: 154
DBLookUpComboBox KeyValue
« on: August 25, 2010, 01:53:35 am »
the current LCL's TDBLookUpComboBox does not have KeyValue property. This is very unfortunate and I think very badly needed. I am considering taking the time to implement it myself, but before I would like to know if there are any (open source) third party components which have a more advanced DBLookUpComboBox

Another deficiency is no way to limit to the lookup items. A user can fill the text box with useless characters that don't specify any record of the listsource.

paolopeg

  • Newbie
  • Posts: 3
Re: DBLookUpComboBox KeyValue
« Reply #1 on: August 26, 2010, 10:08:02 pm »
You're searching 4

DBLookupComboBox1.Field.Value

In fact the key_field value is the real datafield associated to the component! So you need only to look at the current value in the query/table.

If u want the listfield just look at

DBLookupComboBox1.Caption

Bye

99Percent

  • Full Member
  • ***
  • Posts: 154
Re: DBLookUpComboBox KeyValue
« Reply #2 on: August 27, 2010, 09:08:08 pm »
Thanks.

I forgot to mention that I want to use the DBLookUpCombo Box without a datasource, using the listsource only.

juanparati

  • Newbie
  • Posts: 1
Re: DBLookUpComboBox KeyValue
« Reply #3 on: November 07, 2010, 08:01:46 pm »
You can get the index field (or other field) directly from the source table.

Example:

Code: [Select]
myTable.RecNo := myDBCombo.ItemIndex + 1;

indexvalue := myTable.FieldByName(myDBCombo.KeyField).Value;

 8-)

99Percent

  • Full Member
  • ***
  • Posts: 154
Re: DBLookUpComboBox KeyValue
« Reply #4 on: November 08, 2010, 03:34:45 am »
Thanks but DBLookUpComboBox.KeyValue seems to be implemented in the lastest SVN versions. I will try it soon.

danilo666

  • Newbie
  • Posts: 4
Re: DBLookUpComboBox KeyValue
« Reply #5 on: November 10, 2010, 11:53:21 am »
How I update the version of lazarus with dblookupcombobox.keyvalue when have.

danilo666

  • Newbie
  • Posts: 4
Re: DBLookUpComboBox KeyValue
« Reply #6 on: November 11, 2010, 11:01:12 am »
Thank's Juan Parati, I tested your code and worked perfect