Results 1 to 3 of 3

Thread: Listview - why cant i add text to subitems? (always get an error) *Unresolved*

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2003
    Posts
    1,269

    Listview - why cant i add text to subitems? (always get an error) *Unresolved*

    LVW.Items(2).SubItems(2).Text = "ready"
    LVW.Items(1).SubItems(1).Text = "ready"
    LVW.Items.Item(1).SubItems(2).Text = "ready"

    nothing works!

    i have a listview, about 30 rows, and 5 colums.. why isnt this working?

    i keep getting arguement out of range?
    Last edited by VaxoP; Aug 1st, 2003 at 09:01 PM.

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2003
    Posts
    1,269
    The only way i was able to add them was with
    LVW.Items(1).SubItems.Add("***")

    but how can i add something to the 3rd column?

    please please tell me theres a way to do it without having to set everything as a listviewsubitem or something

    Please tell me this isnt the only way to do it..
    Code:
    lCurrent = lvw.Items.Add("text")
    lCurrent.SubItems.Add("text")
    i have all the items added on startup to the first column, the program fills in the other columns when it runs.. the above method would be useless to me.

    isnt there a one line way to add a subitem?
    Last edited by VaxoP; Aug 1st, 2003 at 09:19 PM.

  3. #3
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    you can add subitems like this :
    VB Code:
    1. With ListView1
    2.             .Items.Add("a main item")
    3.             .Items(0).SubItems.Add("first subitem") '/// first subitem.
    4.             .Items(0).SubItems.Add("second?") '///second subitem.
    5.         End With
    you could also add them all in 1 go , using AddRange , eg:
    VB Code:
    1. Dim lItems() As String = {"first subitem", "second?"}
    2.         With ListView1
    3.             .Items.Add("a main item")
    4.             .Items(0).SubItems.AddRange(lItems) '/// add all of em in 1 go..
    5.         End With
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width