Home > Back-end >  Delphi how to automatically search for the contents of the listbox and automatic connection
Delphi how to automatically search for the contents of the listbox and automatic connection

Time:09-19

Delphi how to automatically search for the contents of the listbox and automatic connection? Need to create a new edit controls? In editchange program?

CodePudding user response:

ListBox1. The Items is StringList type, we can through the ListBox1. Items. The Strings [I] access all values
Search
 S:=Edit1. Text; 
For I:=0 to ListBox1. Items. Do the Count - 1
The begin
If S=ListBox1. Items. Strings [I] then//find the specified item
The begin
ListBox1. ItemIndex:=I;
exit;
end;
end;


  • Related