Results 1 to 3 of 3

Thread: Listbox & ListView Items.Add()

  1. #1

    Thread Starter
    Junior Member joan_fl's Avatar
    Join Date
    Aug 2002
    Location
    Tampa, FL
    Posts
    28

    Listbox & ListView Items.Add()

    Am I missing something here...? Or has anyone notice how you can add an Object to a Listbox via Items.Add() and its not possible with the ListView. I'm really suprised an object can not be part of the ListView Items collection. Any suggestions?

    Thanks in advance,
    Joan

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    I can't see any problems . I tried both methods , they worked just fine .

  3. #3

    Thread Starter
    Junior Member joan_fl's Avatar
    Join Date
    Aug 2002
    Location
    Tampa, FL
    Posts
    28
    I tried both methods , they worked just fine
    Yes both methods work in each of their respected classes, but the signitures are totally different. How do you add an object to to a ListView Items collection.. ???? It's signiture doesnt support it.

    Here are teh ListView's overloaded methods for Add for it's Items collection.

    [C#] public virtual ListViewItem Add(ListViewItem);

    [C#] public virtual ListViewItem Add(string);

    [C#] public virtual ListViewItem Add(string, int);

    Now here is the signiture ListBox Items only Add method.
    [C#] public int Add(object item);

    The ListBox takes a generic Object as a parameter which is VERY NICE, and flexible...

    Joan

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