Solved

ListView Question Urgent

Posted on 2004-04-02
6
210 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 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

17 Experts available now in Live!

Get 1:1 Help Now