• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 173
  • Last Modified:

Select All in listview

how can i select all in listview with one click
0
esk
Asked:
esk
  • 5
  • 4
  • 3
1 Solution
 
TheNeilCommented:
Can you use the OnClick method and simply select everything in that?

The Neil
0
 
eskAuthor Commented:
i want to push a button, after that it selects all in this listview
0
 
eskAuthor Commented:
this is like multiselect , but i push a button and it select self all item
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
JaymolCommented:
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.
0
 
JaymolCommented:
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.
0
 
TheNeilCommented:
Create your button then add something along the lines of the following:

VAR
  iCount : INTEGER;
begin
  FOR iCount := 0 TO (ListView1.Items.Count - 1)
  DO
    ListView1.Items[iCount].Selected := TRUE;
  ListView1.SetFocus;
end;

The Neil
0
 
TheNeilCommented:
p.s. Make sure you set the MultiSelect property of your TListView to TRUE else it won't work

The Neil
0
 
JaymolCommented:
Ha!  (Forgot to mention MultiSelect though!)

John.
0
 
eskAuthor Commented:
work!!!
0
 
TheNeilCommented:
Thanks Esk,

Sorry John - looks like I won this time

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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now