Solved

ListView Question Urgent

Posted on 2004-04-02
6
212 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

803 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