|
-
May 24th, 1999, 05:11 PM
#1
CListCtrl Question
how do i insert an item into a list control?
i use InsertItem(nItem, CString) to insert it but it doesnt work.
this is the exact code i use:
m_listCtrl.InsertItem(m_listCtrl.GetItemCount(), dlg.m_textQ);
answers to why this wont help is appreciated.
thanks,
L5
-
May 24th, 1999, 07:44 PM
#2
Re: CListCtrl Question
Try this instead
CListCtrl* pList = (CListCtrl*) GetDlgItem(IDC_YOUR_LIST_ID);
pList->InsertItem(m_listCtrl.GetItemCount(), dlg.m_textQ);
-
May 24th, 1999, 07:55 PM
#3
Re: CListCtrl Question
I am afraid you should insert at least one column into the ListCtrl before you insert any items. So try put following line in your OnInitDialog function or OnInitialUpdate():
m_listCtrl.InsertColumn(0, _T("ColumnHead Text"), LVCFMT_LEFT, 100, 0);
For more information about InsertColumn() see MSDN.
Good luck.
--
mailto://[email protected]
-
May 24th, 1999, 07:56 PM
#4
Re: CListCtrl Question
Try this up...
int iTotalItem =m_ListControl.GetItemCount()
m_ListControl.InsertItem(iTotalItem,"");
m_ListControl.SetItemText(iTotalItem, 0,"Hello");
-
May 25th, 1999, 05:24 AM
#5
Re: CListCtrl Question
if your CListCtrl is in report view, then you have to make the columns first.
m_ListCtrl.InsertColumn(1,"Directory",LVCFMT_LEFT,140,-1);
Mark
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|