Solved

How to fill my TListview with data coming from edits?

Posted on 2006-11-15
3
182 Views
Last Modified: 2010-04-05
Hi Folks,

Another one for ya >

How can I fill my TListview (three columns) with the text from 2 edits and 1 combobox?

Kind regards,

Paul


lv.Items.Item[i].caption := AddForm.edtOmschrijving.Text;
lv.Items.Item[0].SubItems[1]:= AddForm.cboSchakelopties.Text;
the third column being ?



0
Comment
Question by:PeterdeB
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 28

Accepted Solution

by:
2266180 earned 500 total points
ID: 17946562
that depends on your listview style. since you mention 3 columns I suspect it's a vsreport. in this case
for row X
column1 is lv.Items.Item[x].caption
column2 is lv.Items.Item[x].subitems[0]
column3 is lv.Items.Item[x].subitems[1]

so in your case that would translate to:
with lv.Items.add do
begin
  caption := AddForm.edtOmschrijving.Text;
  SubItems.add(AddForm.cboSchakelopties.Text);
  SubItems.add( AddForm.thecombobox.text);
end;
0
 

Author Comment

by:PeterdeB
ID: 17947316
Hi Ciuly!

First of all thanks for you reply!

I can't get it working with three columsn...I must be overlooking somehting but I have no idea as to what that might be....

procedure TForm1.Button1Click(Sender: TObject);
begin
   AddForm.Startup;
  if (AddForm.ShowModal = mrOK) then
  begin
      with lv.Items.add do
begin
  caption := AddForm.edtOmschrijving.Text;
  SubItems.add(AddForm.edtEntry.Text);
  SubItems.add( 'blah');
end;

This fills the first two columns....regardless of what I put into the second SubItems.Add

kind regards,

Paul
0
 

Author Comment

by:PeterdeB
ID: 17947335
Geeeez....a little embarassed here....I see what I have been dong now....silly me ;-) In the object inspector....I defined two columns stead of three!

Kind regards,

Paul
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

730 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