Solved

Getting ListView to work.

Posted on 1998-07-30
1
146 Views
Last Modified: 2010-04-04
Could someone please post an example of how to get the ListView component to work. I have it setup for a report view with 2 columns. I just can't seem to get it too add items and sub items. I'm using version 3.0.
Thanks
0
Comment
Question by:LostOne
1 Comment
 
LVL 5

Accepted Solution

by:
JimBob091197 earned 100 total points
ID: 1359289
Hi

Have you set up your listview's columns?  This is an example which adds 2 columns, then some data to a listview.  (My listview is called lvTest.)

  // Set the view style.
  lvTest.ViewStyle := vsReport;

  // Add some columns.
  with lvTest.Columns.Add do
    begin
      Caption := 'First Column';
      Width := 100;
    end;
  with lvTest.Columns.Add do
    begin
      Caption := 'Second Column';
      Width := 100;
    end;

  // Add some items.
  with lvTest.Items.Add do
    begin
      Caption := 'First Caption';
      SubItems.Add('This is in 2nd col.');
    end;
  with lvTest.Items.Add do
    begin
      Caption := 'Second Caption';
      SubItems.Add('This is in 2nd col.');
    end;

Cheers,
JB
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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
A short film showing how OnPage and Connectwise integration works.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

911 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

22 Experts available now in Live!

Get 1:1 Help Now