0
I have the following problem, when I select an item in Tdbcombobox when leaving the component it automatically selects the last record.
DM_BancoInsumos.IBQCons_ForneInsumos.Close;
DM_BancoInsumos.IBQCons_ForneInsumos.Open;
DBComboFornecedor.Items.Clear;
DBComboFornecedor.Items.Add('Selecione');
while DM_BancoInsumos.IBQCons_ForneInsumos.Eof = False do
begin
DBComboFornecedor.Items.Add(DM_BancoInsumos.IBQCons_ForneInsumosCodFornecedor.Text);
DM_BancoInsumos.IBQCons_ForneInsumos.Next;
end;
In the compound Tdbcombobox:
Style -> csDropDownList
DataSource -> Ds_ConsForncedores
DataFiel -> CodFornecedor
At Datasource
DataSet -> DM_BancoInsumos.IBQCons_ForneInsumos
The problem is that you must have put in the component’s Onchange/Onexit event, with this each time you select one it activates the event and stops at the last, does the search only once and then it will work.
– Jefferson Rudolf
@Jeffersonrudolf put this code in the form’s Onactive, at the Onchange/Onexit events I have no code.
– Tiago Casanova