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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List/Combo Box searching and Sortting help

Status
Not open for further replies.

ironslave

Programmer
Feb 16, 2009
6
0
0
US
Ok... im not new to BCB but it's been about 4 years since i last put any real effort into it and i cant for life of me remember how to search a Combo\ListBox

For the ComboBox i want to select an Item based on what something else says.

Example: if Edit2 says Blue, i want to find Blue in the List for a combobox and select it, the catch is it is Set as a DropDownList.

For the ListBox, i want to have an EditBox above it where the user may type what there looking for and the Listbox will automattically select the closest matching Item as the User Types.

also I would Like any tips on how to Manually sort a Listbox and move Items on Other Listboxes to the same spot.
Example: ListBox1 Item 5 moves to Item 2
I want to Move ListBox2 Item 5 to Item 2 as well

Ive been Searching for a while for an answer and i could not find one. but i am not good at wording things when i search.

I am Using BCB6 BTW
 
Without going into much detail, you will need to find out how many items there are in the combo box. You will then need to iterate through the items via the combo box's index and see if it matches "Blue."

Look in the help file under TComboBox for Items and ItemIndex or something similar.


James P. Cottingham
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
I Acctually found a solution, Allthough not Incremental search as I had hoped.

CombBox->ItemIndex = ComboBox->Items->IndexOf(Edit2->Text);



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top