Link to home
Start Free TrialLog in
Avatar of esk
esk

asked on

Select All in listview

how can i select all in listview with one click
Avatar of TheNeil
TheNeil

Can you use the OnClick method and simply select everything in that?

The Neil
Avatar of esk

ASKER

i want to push a button, after that it selects all in this listview
Avatar of esk

ASKER

this is like multiselect , but i push a button and it select self all item
Simple, but does what you asked for...

procedure TForm1.Button1Click(Sender: TObject);
var
  TmpI : Integer;
begin
  For TmpI:=0 to ListBox1.Items.Count-1 do
  ListBox1.Selected[TmpI]:=True;
end;

Hope this helps,

John.
Doh!!!  Sorry.....You said listview, not listbox....

For TmpI:=0 to ListView1.Items.Count-1 do
ListView1.Items[TmpI].Selected:=True;
ListView1.SetFocus;

That'll do the trick!

John.
ASKER CERTIFIED SOLUTION
Avatar of TheNeil
TheNeil

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
p.s. Make sure you set the MultiSelect property of your TListView to TRUE else it won't work

The Neil
Ha!  (Forgot to mention MultiSelect though!)

John.
Avatar of esk

ASKER

work!!!
Thanks Esk,

Sorry John - looks like I won this time

The Neil
This is pathetic.  I'm getting pissed off with you so called Experts.
Who answered you first?