vari,count:integer; index:integer; begin count:=listview1.Columns.Count; for i:=0 to count-1 do if listview1.Columns[i].Caption='性别' then begin index:=i; break; end;end;
procedure TForm1.Button1Click(Sender: TObject); var i: integer; begin for i :=0 to Self.ListView1.Columns.Count-1 do if Self.ListView1.Columns[i].Caption = '年龄' then//自己修改查找内容 showmessage('年龄是第 '+inttostr(i+1)+' 列'); end;
index:integer;
begin
count:=listview1.Columns.Count;
for i:=0 to count-1 do
if listview1.Columns[i].Caption='性别' then
begin
index:=i;
break;
end;end;
var
i: integer;
begin
for i :=0 to Self.ListView1.Columns.Count-1 do
if Self.ListView1.Columns[i].Caption = '年龄' then//自己修改查找内容
showmessage('年龄是第 '+inttostr(i+1)+' 列');
end;