Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Listview problem

Options
  • 29-01-2003 2:45pm
    #1
    Registered Users Posts: 950 ✭✭✭


    Hello All

    I have a small problem where I am trying to read data from a 4 column listview set to report style if someone could give me a code example on how to read more than the first column (preferably all columns) I would be grateful.
    the programming language is borland c++ builder 4:cool:


Comments

  • Closed Accounts Posts: 9,314 ✭✭✭Talliesin


    How is the listview created? "Raw" Windows listview, "Raw" listview from some other OS, or a framework class?


  • Registered Users Posts: 2,150 ✭✭✭dazberry


    Jessy

    Since you're using C++ Builder 4 I'm guessing you're using the VCL. Its about 6 yrs (!!! - I didn't realise it was so long until now - f) since I've done any C++, but from the VCL point of view, the following will get you on the right track (in Delphi). I guess, replace := with = and . with -> (don't quote me on it) and all the other bits ;)

    var
    LI : TListItem;
    begin
    LI:=ListView1.Items[0];

    Label1.Caption:=LI.Caption;
    Label2.Caption:=LI.SubItems.Strings[0];
    Label3.Caption:=LI.SubItems.Strings[1];
    Label4.Caption:=LI.SubItems.Strings[2];
    end;

    Things to note.

    Subitems is of type tStrings, so Subitems.count, Subitems[index] / Subitems.strings[index], Subitems.objects[index] etc. are all valid. So all those "rules" (ignored above) apply.

    HTH

    D.


Advertisement