• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 187
  • Last Modified:

How to fill my TListview with data coming from edits?

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
PeterdeB
Asked:
PeterdeB
  • 2
1 Solution
 
2266180Commented:
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
 
PeterdeBAuthor Commented:
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
 
PeterdeBAuthor Commented:
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

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.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now