procedure TForm1.Button1Click(Sender: TObject); var I:integer; str:string; begin str :=UpperCase(Edit1.Text); for I:=0 to ListBox1.Items.Count -1 do Begin if pos(str,upperCase(ListBox1.Items[i]))>0 then ListBox1.Selected[i]:= true else ListBox1.Selected[i] := false; end; end;
抢分
我不能让LISTBOX取得焦点,比如说我要像金山词霸那样,或者说比那个更难
举个例题吧,我的LISTBOX中有3条记录的前一个字符是"A",现在我在另一个输入中输入一个"A"字符,回车后我的LISTBOX要能选中这3条记录.
多多灌水,来者有分,有100分嘛!
listbox1.Selected[2]:=true;
listbox1.Update;//或lisbox1.selectall;
listbox1.update;
var
I:integer;
str:string;
begin
str :=UpperCase(Edit1.Text);
for I:=0 to ListBox1.Items.Count -1 do
Begin
if pos(str,upperCase(ListBox1.Items[i]))>0 then
ListBox1.Selected[i]:= true
else ListBox1.Selected[i] := false;
end;
end;