Solved

ListView Question Urgent

Posted on 2004-04-02
6
211 Views
Last Modified: 2010-04-05
Hi all

I've got a listview that collects a list of emails using POP3.

It contains these fields: ID //which is a number that it looks for and filters using Case etc... loop.
Account Number,Title,Firstname and Surname.  

The first field is a number. Now if a number is found it must then get the number plus all the other fields and put it in a memo for example.

This is what i have right now but it only get's the first field, i also need the others.

Here the code i'm using right now:

var
I, tmp: Integer;



Begin
for I:= 0 to ListView1.Items.Count - 1 do
begin
 tmp:=  StrToInt(ListView1.Items[I].Caption);
 case tmp of
  0:Showmessage('0 Found');
  1:Showmessage('Hello'+ListView1.Items[I].Caption);
  2:Showmessage('2 Found');
  3:Showmessage('3 Found');
  4:Showmessage('4 Found');
  5:Showmessage('5 Found');
  6:Showmessage('6 Found');
  7:Memo1.Lines.Add( ListView1.Items[I].Caption );
 end;
 end;

 end;

Can you please help?

Thanks

Drive2000

p.s: I'm giving all the point i have left.
0
Comment
Question by:Drive2000
  • 4
  • 2
6 Comments
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10741671
Use the SubItems property of Items

 for I:= 0 to ListView.Items.Count - 1 do
  Memo1.Lines.Add( ListView1.Items[I].Caption + ' ,' +
                           ListView1.Items[I].SubItems[0] + ',' +
                           ListView1.Items[I].SubItems[1] + ',' +
                             );


 Shane
0
 
LVL 11

Accepted Solution

by:
shaneholmes earned 125 total points
ID: 10741679
Begin
for I:= 0 to ListView1.Items.Count - 1 do
begin
 tmp:=  StrToInt(ListView1.Items[I].Caption);
 case tmp of
  0:Showmessage('0 Found');
  1:Showmessage('Hello'+ListView1.Items[I].Caption);
  2:Showmessage('2 Found');
  3:Showmessage('3 Found');
  4:Showmessage('4 Found');
  5:Showmessage('5 Found');
  6:Showmessage('6 Found');
  7: Memo1.Lines.Add( ListView1.Items[I].Caption + ' ,' +
                           ListView1.Items[I].SubItems[0] + ',' +
                           ListView1.Items[I].SubItems[1] + ',' +
                             );

 end;
 end;

Shane
0
 

Author Comment

by:Drive2000
ID: 10741807
I'm getting an error at the end.

Error= Expression expected but ')' found.
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.

 

Author Comment

by:Drive2000
ID: 10741850
OK i found what the problem was :)

It works great !!!

Thanks a million.

Drive2000 .
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10741854
sorry,

remove the  +',' +

ListView1.Items[I].SubItems[1] ;


Shane
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10741864
i left that on so you could add more fields if needed,

example

7: Memo1.Lines.Add( ListView1.Items[I].Caption + ' ,' +
                           ListView1.Items[I].SubItems[0] + ',' +
                           ListView1.Items[I].SubItems[1] + ',' +
                           ListView1.Items[I].SubItems[2] + ',' +
                           ListView1.Items[I].SubItems[3] + ',' +
                           ListView1.Items[I].SubItems[4] );

It all depends on how many subitems you have.

Shane
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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

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

20 Experts available now in Live!

Get 1:1 Help Now