Topic: How Reverse Show Data form edit.text To combobox.dbItemID+parent

My lesson  i don't record in table is id(number) but record text(TA,TB)
for easy print or report design

Step 1 Script to record from combobox.dbItemID to edit.text

//send data combobox.dbitemid to edit.text
procedure summary_editor_ComboBox1_OnChange (Sender: string);
begin
summary_editor.Edit1.Text :=
SQLExecute(
'select table_a.TA from table_a where table_a.id ='+
inttostr(summary_editor.ComboBox1.dbItemID));

summary_editor.Edit2.Text :=
SQLExecute(
'select table_b.TB from table_b where table_b.id ='+
inttostr(summary_editor.ComboBox2.dbItemID));
end;
procedure summary_editor_ComboBox2_OnChange (Sender: string);
begin
summary_editor.Edit1.Text :=
SQLExecute(
'select table_a.TA from table_a where table_a.id ='+
inttostr(summary_editor.ComboBox1.dbItemID));

summary_editor.Edit2.Text :=
SQLExecute(
'select table_b.TB from table_b where table_b.id ='+
inttostr(summary_editor.ComboBox2.dbItemID));
end;

--- It OK No error
 


Step 2 I want to show data form edit.text To combobox.dbItemID when edit
but combobox have parent it display combobox1 only

//reverse show edit.text to combobox.dbitemid
procedure summary_editor_OnShow (Sender: string; Action: string);
begin
summary_editor.ComboBox1.dbItemID :=
SQLExecute(
'select table_a.id from table_a where table_a.TA ="'+
(summary_editor.Edit1.Text)+'"');

summary_editor.ComboBox2.dbItemID :=
SQLExecute(
'select table_b.id from table_b where table_b.TB ="'+
(summary_editor.Edit2.Text)+'"');
end;

why combobox2 no show ?

help me please !

Post's attachments

Attachment icon Lesson Combobox parent.zip 326.53 kb, 471 downloads since 2016-02-11 

My Visual Database : I Love You
Easy For Beginner Student For Me

Re: How Reverse Show Data form edit.text To combobox.dbItemID+parent

I made some changes in your project:

Post's attachments

Attachment icon Lesson Combobox parent_fixed.zip 6.04 kb, 533 downloads since 2016-02-12 

Dmitry.

Re: How Reverse Show Data form edit.text To combobox.dbItemID+parent

IT Code OK No Error
I'm Tested

Thank You Dmitry.

My Visual Database : I Love You
Easy For Beginner Student For Me

Re: How Reverse Show Data form edit.text To combobox.dbItemID+parent

Hello.. I am new ni mvd and have one question from this topic.

how to add value of Multi Select Combobox to EditText?

Example value on EditText to save into table db : A10, A20, A30

So i can save record the value with comma (,) into database.

Thanks for help.

Re: How Reverse Show Data form edit.text To combobox.dbItemID+parent

agazs wrote:

Hello.. I am new ni mvd and have one question from this topic.

how to add value of Multi Select Combobox to EditText?

Example value on EditText to save into table db : A10, A20, A30

So i can save record the value with comma (,) into database.

Thanks for help.

It's pretty simple. Add a handler on the save button (onClick), in which copy the text property from the combobox to the edit:

procedure EditForm_btnSave_OnClick (Sender: TObject; var Cancel: boolean);
begin
  EditForm.Edit1.Text := EditForm.ComboBox1.Text;
end;
Визуальное программирование: блог и телеграм-канал.