Solved

ListView Question Urgent

Posted on 2004-04-02
6
213 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
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 

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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
Run video youtube webbrowse 10 65
Adoquery sql  left join does not work 25 99
Twebbrowser add css to the header 3 28
Problem working with dynamic array - help 2 4
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
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…

828 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