Thread: How to insert an item to a ListView

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    8

    How to insert an item to a ListView

    Hi guys, just wanna ask how do i insert an item to a ListView.
    In my list, I added a popup menu and one of the option is an
    INSERT option. now when this option is clicked, I need to
    insert that item before the selected item.
    I am having problems determining the position to where I
    will insert the Item....

    so far this is what I have....

    Code:
       pListView->Items->Insert(pListView->Items->Item->Index);
       pItem->Caption = "INSERT";
       for (int j = 1; j <= 10; j++)
          {
             pItem->SubItems->Add(0);
          }
    however, i am having a compile error
    E2193 Too few parameters in call to '_fastcall TListItems::GetItem(int);

    I can't figure it out, please help in fixing this problem..

    thnx.

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    >E2193 Too few parameters in call to '_fastcall TListItems::GetItem(int)
    Where's the code which calls GetItem? It looks like you should be passing it an int argument.

  3. #3
    Registered User
    Join Date
    Apr 2007
    Posts
    8
    already fixed the problem...
    the code should be...

    Code:
       pItem = pListView->Items->Insert(pListView->Selected->Index);
       pItem->Caption = "INSERT";
       for (int j = 1; j <= 10; j++)
          {
             pItem->SubItems->Add(0);
          }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Immediate programming help! Please!
    By xMEGANx in forum C++ Programming
    Replies: 6
    Last Post: 02-20-2008, 12:52 PM
  2. Retail Outlet Managment System - the 4th
    By Presidentofusa in forum C Programming
    Replies: 3
    Last Post: 11-10-2007, 10:44 PM
  3. Replies: 6
    Last Post: 07-10-2006, 12:05 AM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. Struct *** initialization
    By Saravanan in forum C Programming
    Replies: 20
    Last Post: 10-09-2003, 12:04 PM