Solved

Select All in listview

Posted on 2000-02-14
12
165 Views
Last Modified: 2010-04-04
how can i select all in listview with one click
0
Comment
Question by:esk
  • 5
  • 4
  • 3
12 Comments
 
LVL 5

Expert Comment

by:TheNeil
ID: 2518740
Can you use the OnClick method and simply select everything in that?

The Neil
0
 

Author Comment

by:esk
ID: 2518924
i want to push a button, after that it selects all in this listview
0
 

Author Comment

by:esk
ID: 2518927
this is like multiselect , but i push a button and it select self all item
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 2518972
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
 
LVL 6

Expert Comment

by:Jaymol
ID: 2518986
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
 
LVL 5

Accepted Solution

by:
TheNeil earned 50 total points
ID: 2518993
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 5

Expert Comment

by:TheNeil
ID: 2519003
p.s. Make sure you set the MultiSelect property of your TListView to TRUE else it won't work

The Neil
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 2519018
Ha!  (Forgot to mention MultiSelect though!)

John.
0
 

Author Comment

by:esk
ID: 2519258
work!!!
0
 
LVL 5

Expert Comment

by:TheNeil
ID: 2519289
Thanks Esk,

Sorry John - looks like I won this time

The Neil
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 2522175
This is pathetic.  I'm getting pissed off with you so called Experts.
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 2522179
Who answered you first?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now