• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 579
  • Last Modified:

Adding a row to the listview....

i have a listview with 2 columns.. i need to add a row in that list view....
how can i do that... now i am able to add a row with only a single colum...
the code looks like this....


    lvitem.mask      =   LVIF_STATE | LVIF_TEXT | LVIF_PARAM;
    lvitem.state     =   0;
    lvitem.stateMask =   0;  

    lvitem.iItem     = 0;
    lvitem.iSubItem  = 0;
    lvitem.pszText   = lvi.pszText;

    lvitem.pszText   = "hai";

    lvitem.lParam        =      (LPARAM)23;

     ListView_InsertItem(<Handle to the list view> ,&lvitem);
0
r_a_j_e_s_h
Asked:
r_a_j_e_s_h
  • 2
  • 2
1 Solution
 
AlexFMCommented:
Use ListView_SetItem Macro. Set LVITEM::iItem to item number in the list, LVITEM::iSubItem to column number (1), LVITEM::pszText to subitem text.
0
 
AlexFMCommented:
LVITEM::iItem should be equal to value returned by ListView_InsertItem.
0
 
r_a_j_e_s_hAuthor Commented:
i solved it.,.. this is the code....


lvitem.mask      =   LVIF_STATE | LVIF_TEXT | LVIF_PARAM;
    lvitem.state     =   0;
    lvitem.stateMask =   0;  

    lvitem.iItem     = 0;
    lvitem.iSubItem  = 1;
    lvitem.pszText   = lvi.pszText;

    lvitem.pszText   = "hai";

    lvitem.lParam       =     (LPARAM)23;

     ListView_InsertItem(<Handle to the list view> ,&lvitem);
0
 
r_a_j_e_s_hAuthor Commented:
ListView_setItemtext() will do
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now