Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Look up combo box Tip needed

Status
Not open for further replies.

jbpelletier

Programmer
Sep 8, 2001
232
CA
I have 2 lookup combo box...
the 2sd combo box list depend on the first combo box selection.


when i change the value in my first combo box, the 2sd combo list change ok.. but the text dont change right after
the change. For exemple:

1st table = month
day

2sd table = month,jan
month,...
month,dec
day,sunday
day,...
day,saturday

If i select from the 1st combo month then in the seconde combo Dec.. then i select day from the 1st combo..

its displaying combo1: DAY combo2 : DEC
whats is competly stupid..
how can i update the 2sd combo text right afetr a selection change in the 1st combo.. (combo=lookupcombobox)


tanx.. jb

 
Perhaps you can change the items property of the 2nd combo box to reflect the contents of the first one. You'll probably do this in an event handler for the first combo box.
 
In the OnChange event for the first combo box you can change the value selected in the second combo box, or the available values in the second combo box.

Does that help?

TealWren
 
TealWren:
Na not really.. i already know that, i need to know how to change that value.. i found no method or propriety able to change the text value of a lookup combo box. Name.Text is read only, and thing like update, refresh ect.. dont work..

My question should be : How to change the text value of a lookup combo box in my code?

Jb
 
Fill the items of the 2nd combobox in at runtime:


procedure TForm1.ComboBox1Change(Sender: TObject);
begin
case Combobox1.ItemIndex of
0: begin selection is month
combobox2.Clear;
combobox2.Items.Add('January');
combobox2.Items.Add('February');
//etc
Combobox2.ItemIndex := 0; //Update the text in the 2nd combobox
end;

1: begin selection is day
combobox2.Clear;
combobox2.Items.Add('Monday');
combobox2.Items.Add('Tuesday');
etc
Combobox2.ItemIndex := 0;
end;
end; //case
end;


Regards S. van Els
SAvanEls@cq-link.sr
 
Hi again,

I have think i have some difficulty to explain what is my problem..

1) im not using ComboBox, im using LookUpComboBox, proprety and method r a bit different..

2) the Month/Day thing was only an exemple

3) My 2sd LookUpComboBox have for MasterSource The value of the 1st LookUpComboBox (going via table used as source for the 1st LookUpComboBox ). All working well, when i change the value of the first LookUpComboBox the list of the 2sd LookUpComboBox update correctly .. BUT THE TEXT DONT. So the Text shown isn't in relation with the text show by the 1st LookUpComboBox(like FOR exemple DAY = JANUARY).

***I just whant to update the 2sd LookUpComboBox Text to the first value of the 2sd LookUpComboBox list***

.. but i cant modify the text of the 2sd LookUpComboBox in the code because the Text propriety is ReadOnly.

tanx again

jb.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top