Solved

Select All in listview

Posted on 2000-02-14
12
163 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
Comment Utility
Can you use the OnClick method and simply select everything in that?

The Neil
0
 

Author Comment

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

Author Comment

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

Expert Comment

by:Jaymol
Comment Utility
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
Comment Utility
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
Comment Utility
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 5

Expert Comment

by:TheNeil
Comment Utility
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
Comment Utility
Ha!  (Forgot to mention MultiSelect though!)

John.
0
 

Author Comment

by:esk
Comment Utility
work!!!
0
 
LVL 5

Expert Comment

by:TheNeil
Comment Utility
Thanks Esk,

Sorry John - looks like I won this time

The Neil
0
 
LVL 6

Expert Comment

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

Expert Comment

by:Jaymol
Comment Utility
Who answered you first?
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 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

15 Experts available now in Live!

Get 1:1 Help Now