ST3VO
asked on
Search For Column in a ListView
Hi all,
I've got a liitle prolem with a listview.
I need some code to search IF a Column Called 'ID' exists or not in the ListView.
How can I do that please?
Thanks
ST3VO
I've got a liitle prolem with a listview.
I need some code to search IF a Column Called 'ID' exists or not in the ListView.
How can I do that please?
Thanks
ST3VO
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry small error in the first code.
function getColumnIndex(sname : String) : Integer;
var
res,i : Integer;
begin
res := -1
with ListView1 do
for i := 0 to Columns.Count - 1 do
if CompareStr(Columns[i].Capt ion, sname) = 0 then
begin
Result := i;
Break;
end;
end;
Result := res;
end;
Regards,
Tomas Helgi
function getColumnIndex(sname : String) : Integer;
var
res,i : Integer;
begin
res := -1
with ListView1 do
for i := 0 to Columns.Count - 1 do
if CompareStr(Columns[i].Capt
begin
Result := i;
Break;
end;
end;
Result := res;
end;
Regards,
Tomas Helgi
ASKER
Thanks!!!
You could do it something like this:
function getColumnIndex(sname : String) : Integer;
var
res : Integer;
begin
res := -1
with ListView1 do
for ItemIndex := 0 to Columns.Count - 1 do
if CompareStr(Columns[ItemInd
begin
Result := ItemIndex;
Break;
end;
end;
Result := res;
end;
Regards,
Tomas Helgi