[SOLVED] Index selection via a TComboBox lazarus / 63-Database ---------------------------------------------------------------------- 1HuntnMan · 2023-12-15 14:38 I've seen this design in other apps such as MyDBF Studio.  This is the way I designed a TComboBox for selecting/changing the index for a particular table. This app is designed with dBase v7, see below the Case statement allowing the user to select a sort/index stored in the Items/TStrings. Compiles but when I run it, it's not selecting what I selected or rather the Case statement I wrote is not right. When I test, it's not executing the Case selections, it's dropping into the ELSE. Should I be using DBListBox or combo instead? procedure TFrmCntksMain.CmboBxIndexBySelect(Sender: TObject); begin   Case CmboBxIndexBy.SelText of     'Contact ID#':DbfContacts.IndexName:= 'CONTACTID';     'Name(L,F,M)':DbfContacts.IndexName:= 'CNTKNAME';     'Category':DbfContacts.IndexName:= 'CATEGORY';     'State/Province':DbfContacts.IndexName:= 'STATPROV';     'Country':DbfContacts.IndexName:= 'CNTRYCODE';   else     WriteLn('Index value not selected...');   end;   DbfContacts.Refresh; end; ---------------------------------------------------------------------- wp · 2023-12-15 15:06 Combobox.SelText? This is the text currently highlighted in the combobox's edit field in the csDropDown style. Be aware that items may be selected in the combobox, but necessarily highlighted! Or what if the combobox is switched to csDropDownList style? You probably mean the Combobox.Text which behaves more in the way you are expecting. ---------------------------------------------------------------------- 1HuntnMan · 2023-12-15 17:15 Okay WP, thanks.  I'll rework this a bit from your suggestion after I mop the kitchen! My better half is a slave driver! LoL ---------------------------------------------------------------------- 1HuntnMan · 2023-12-15 19:14 Ok WP,   That works perfectly... ---------------------------------------------------------------------- cdbc · 2023-12-15 19:14 Hi Have you considered "TComboBox.ItemIndex"?!? Regards Benny