Delphi怎么自动寻找listbox中的内容并自动连接

wangxin_yu 2017-07-21 02:02:13
Delphi怎么自动寻找listbox中的内容并自动连接?需要新建一个edit控件吗?在editchange里编写程序吗?
...全文
411 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
lyhoo163 2017-07-22
  • 打赏
  • 举报
回复
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;

16,748

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧