Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List Control

Status
Not open for further replies.

HellishER

Programmer
Jun 10, 2002
4
0
0
SE
Hi, im trying to make so when you push a button, it will add the text that are in a textbox to the list control.

m_strAddItem is my textbox member variable.
m_ctlList is my List Control Member variable

I have tried to do it like this but it don´t work.
m_ctlList.InsertItem( m_strAddItem );

I don´t know what to write between "( );" on the InsertItem function..
 
If you pass a single parameter to this funtion, then it must be a LVITEM structure eg.
typedef struct _LVITEM {
UINT mask;
int iItem;
int iSubItem;
UINT state;
UINT stateMask;
LPTSTR pszText;
int cchTextMax;
int iImage;
LPARAM lParam;
#if (_WIN32_IE >= 0x0300)
int iIndent;
#endif
} LVITEM, FAR *LPLVITEM;

Otherwise, if passing a type of CSTRING requires an index be passed with it..
int InsertItem( int nItem, LPCTSTR lpszItem );

were nItem is the index of the item to be inserted (needs to know where to put it).

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top