Board index » delphi » Exchanging two listitems in Listview

Exchanging two listitems in Listview

hi,

how can I exchange two listitems in a listview ?
I would like to move listitem at position 2 to position 1 and vice versa?

thx

arnold

 

Re:Exchanging two listitems in Listview


Try

procedure Swap(a,b:integer);
var
   cItem : TListITem;
begin
cItem := Listview1.Items.Add;
cItem.Assign(Listview1.items[a]);
Listview1.items[a].assign(listview1.items[b])
ListView1.items[b].assign(cItem);
cItem.delete;
end;

Ron.

Quote
"Arnold" <a.ange...@teamaxess.com> wrote in message

news:3da3f839@newsgroups.borland.com...
Quote
> hi,

> how can I exchange two listitems in a listview ?
> I would like to move listitem at position 2 to position 1 and vice versa?

> thx

> arnold

Other Threads