Topic: Add items to combobox
I cant find in the Manual how to add items to Combobox?
My Visual Database → General → Add items to combobox
I cant find in the Manual how to add items to Combobox?
you can see attachment as example from me
maybe can help you
Hi Markos,
There are different ways to add items to comboboxes.
For me, the easiest is to put all of the tables that you want to hold combobox values for on one form, access it using a 'showform' button and use editable grids to maintain them.
It avoids having any script so there is no programming overhead when you need to add or change values.
More importantly, referential integrity is maintained which is not the case when you built combobox entries by script.
Having all your 'dictionary' maintenance on one form means it's also very easy to limit access to authorised users only.
Please see attached for an example.
Derek.
Thanks.
I thought it was simpler, like in VB.net (add manually or by simple code).
What I need is to create two comboboxes with 3 items each (read only).
Is there something like radio button or list box instead?
Or I need to use the check boxes that is unsuitable for my applications because only one item must be selected.
This works for me:
procedure Form1_OnShow (Sender: TObject; Action: string);
begin
Form1.ComboBox1.Items.Add('mm');
Form1.ComboBox1.Items.Add('inches');
Form1.ComboBox2.Items.Add('mm');
Form1.ComboBox2.Items.Add('AWG');
Form1.ComboBox2.Items.Add('SWG');
end;
One more thing.
Is there a possibility for the ComboBox to "remember" previously selected item each time the program is opened?
MarkoS,
If you do not want to use tables for storing combobox values as Derek provided, then you need to manually load the combobox through script. There are two options in how you store the combobox values. You can either store the actual text value from the combobox or you can store a numeric number (id) of the combobox value. Check out the two options in the attached example. FYI - Option 2 is the more efficient way for database applications. If you look at the raw data in the table you can see the difference between the two options in how the values are stored.
ehwagner,
Thanks.
Works very nice.
My Visual Database → General → Add items to combobox
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi