Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ListView Question Urgent

Posted on 2004-04-02
6
Medium Priority
?
220 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 500 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

824 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