Topic: Search results on ComboBox
Hi,
Can display the result of search as selected item on ComboBox instead TableGrid ?
And Can I create customized list of ComboBox without needs to link in DataBase ?
One can learn and graduate or stay behind.
My Visual Database → General → Search results on ComboBox
Hi,
Can display the result of search as selected item on ComboBox instead TableGrid ?
And Can I create customized list of ComboBox without needs to link in DataBase ?
if Combobox is connected to database then you can use this script
Form1.Combobox1.dbitemid := SQLExecute('select id from mytable where id = myID');
and Second Ans
Form1.combobox1.items.add('MyItem1');
Form1.combobox1.items.add('MyItem2');
Form1.combobox1.items.add('MyItem3');
Hi,
I didn't figure out how to make the search, please see my project and show me my mistake, this code what I write:
procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
begin
Form1.ComboBox1.Items.Text := Form1.Edit1.Text;
end;
procedure Form1_Button2_OnClick (Sender: TObject; var Cancel: boolean);
begin
Form1.ComboBox1.dbUpdate;
Form1.Edit1.Clear;
end;
the search can find the result but the combobox show the first choice is blank
The second answer was great, work perfect.
Hi FMR,
Not too sure what you're trying to do but perhaps try it like this (see attached).
Derek.
Hi FMR,
Not too sure what you're trying to do but perhaps try it like this (see attached).
Derek.
Derek,
Sorry, but I got simi answer. the form1.combobox1.dbItemID := 0; help me alot
Your code keep show me error message
Hi,
Can display the result of search as selected item on ComboBox instead TableGrid ?
And Can I create customized list of ComboBox without needs to link in DataBase ?
procedure Form1_ComboBox1_OnDropDown (Sender: TObject);
var
i :integer;
list :TStringList;
begin
Form1.ComboBox1.Clear;
list:=TStringList.Create;
if ( Form1.Edit1.Text = '' ) then list.Text:=SQLexecute('SELECT group_concat(id, char(13) || char(10)) FROM a ') else
list.Text:=SQLexecute('SELECT group_concat(id, char(13) || char(10)) FROM a WHERE aa LIKE "'+'%'+Form1.Edit1.Text+'%'+'"');
for i := 0 to list.Count-1 do
Form1.ComboBox1.Items.Add(SQLExecute('SELECT aa FROM a WHERE id='+list[i])) ;
list.Free;
end;
My Visual Database → General → Search results on ComboBox
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi