How to show selected value in DBLookupComboBox ? If the condition if in one form a value is selected in one DBLookupComboBox , then the value in the first DBLookupComboBox , on the other form, should also change.
3 answers
Put the handler on the change, and write in it:
if DBLookupComboBox1.Focused then DBLookupComboBox2.KeyValue := DBLookupComboBox1.KeyValue; And for the second:
if DBLookupComboBox2.Focused then DBLookupComboBox1.KeyValue := DBLookupComboBox2.KeyValue; Focused checking that the user is now changing the value in a particular control, and not the handler.
If both DBLookupComboBox are connected to the same table on one form and on another (here I mean the TTable or TADOTable ), then the data should change automatically there as well. If there are many forms in the program, then it is good to use the data module: put all the non-visual components for working with the database there, and connect it to all the required forms. The main DBLookupComboBox is to bind DBLookupComboBox on each form with one table, then you don’t have to write code, and the data will automatically change on both forms. Here is a small test case. 
- I think that if both DBLookupComboBox would be associated with the same DataSet, the person would not have a question :) And so, yes, either the data module or the DataSet on the main form ... - KiTE
- Well I do not know. My classmate once had a similar question. Maybe because he did not write applications for working with DB in Delphi. - DelphiM0ZG
- Here I have everything on the main form. - DelphiM0ZG
- It agree, a question, most likely, from the wrong architecture. - KiTE
Maybe you can just tie dataset on MasterFields !?