Delphi怎么自動尋找listbox中的內容并自動連接?需要新建一個edit控制元件嗎?在editchange里撰寫程式嗎?
uj5u.com熱心網友回復:
ListBox1.Items就是StringList型別,我們可以通過 ListBox1.Items.Strings[i] 訪問全部值搜索
S:=Edit1.Text;
for i:=0 to ListBox1.Items.Count-1 do
begin
if S=ListBox1.Items.Strings[i] then // 找到指定項
begin
ListBox1.ItemIndex:=i;
exit;
end;
end;
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/52154.html
標籤:語言基礎/算法/系統設計
上一篇:delphi#listbox控制元件如何用代碼自動選中指定項
下一篇:問一個簡單的控制元件問題
