listview

This is a discussion on listview within the C# Programming forums, part of the General Programming Boards category; Hi: how to add an array to viewlist? I just can't find the way to define such array so that ...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    173

    listview

    Hi:
    how to add an array to viewlist?
    I just can't find the way to define such array so that I can use it

    I've tried such way:

    viewList1.Item[] item = new viewList1.Item[3];
    ListViewItem[] item = new ListViewItem[3];
    but neither of them works.
    I've checked MSDN
    it has such example:
    viewList1.Item[0].SubItems.Add("John Smith");

    I don't know how to create such things Item[0]
    thanx
    Don't laugh at me,I am just a SuperNewbie.

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    PHP Code:
    ListViewItem l = new ListViewItem();

    l.Text "First Item";

    l.SubItems.Add"subitem1" );
    l.SubItems.Add"subitem2" );  

    listView1.Items.Add); 
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    173
    Thanx, I got it
    and also I found out
    ListViewItem[] item = new ListViewItem[X];
    it works great for arrays.

    but how could I get the subitem's name using something like
    l.subitem.????
    Last edited by SuperNewbie; 07-16-2002 at 01:56 PM.
    Don't laugh at me,I am just a SuperNewbie.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. ListView Refresh, Update
    By de4th in forum C++ Programming
    Replies: 1
    Last Post: 12-23-2006, 08:13 AM
  2. Replies: 6
    Last Post: 07-10-2006, 12:05 AM
  3. Troubles with ListView and Toolbar
    By cornholio in forum Windows Programming
    Replies: 8
    Last Post: 11-14-2005, 12:26 AM
  4. Listview with c/c++
    By X PaYnE X in forum Windows Programming
    Replies: 8
    Last Post: 03-20-2005, 10:29 PM
  5. Listview??
    By SuperNewbie in forum C# Programming
    Replies: 4
    Last Post: 02-13-2003, 02:34 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21