Topic: Editable combobox
Hi everyone,
I want to know that a combobox can be editable? If yes, how it can be?
My Visual Database → General → Editable combobox
Hi everyone,
I want to know that a combobox can be editable? If yes, how it can be?
unforgettable,
By editable do you just want to be able to add items to the combobox or edit them as well?
To add an item directly to the combobox:
{ Function to check if combobox has had a new item added to it}
frmEditPart.cmbEditCategory.dbItemID := add2ComboBox(frmEditPart.cmbEditCategory.text, frmEditPart.cmbEditCategory.dbItemID);
{function to allow selected comboboxes to have new data added to them directly}
function add2ComboBox (Sender: String; indx: Integer): Integer;
begin
if (indx = -1) AND (Sender <> '') then
begin
SQLExecute('INSERT INTO table (field) VALUES ("'+Sender+'")');
UpdateDatabase('TABLE');
Result := Last_Insert_id;
showmessage('TABLE updated with '+Sender )
end
else begin
Result := indx;
end;
end;
Thanks CDB. I want to add data if it is not in combobox. Where do I type these codes on which event? On click event? Can you attached any project as example?
Here you go Unforgettable.
This program is one I use to test out things. All you need to look at is the drop down box. I have used the code in the 'On Close Up' event.
You could if you wished put the calling code in the 'OnClick' event or even have a button with the calling code in.
To use, just type a word into the drop down box without opening the drop down. It will then appear in the table grid and also in the drop down list after you have clicked outside the combobox.
Thank you CDB attaching project which guide me what I want to know. Thanks again.
My Visual Database → General → Editable combobox
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi