Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Im using CString method but its not enough to add 100 items..Please suggest some methods/Codes/Ebooks
Posted
Comments
Richard MacCutchan 6-Mar-15 7:29am    
Your question is not clear, please add more detail.

1 solution

CString is a MFC class that holds a string of chars.
The CListBox control class is used to display a list of strings that the user can choose from.
The CEdit control class is used to display and edit text. It can be set to single line or multiline mode.

In order to add strings to CListBox object you call the CListBo::AddString() method.
For example if you want to add three items "text1", "text2" and "text3" to the list box, you can write this code:
CListBox m_listBox; 
m_listBox.AddString(_T("text1"));
m_listBox.AddString(_T("text2"));
m_listBox.AddString(_T("text3"));

If you need to set a text to CEdit object you can call the CEdi::SetWindowText() method.
For example:
CEdit m_editCtrl;
m_editCtrl.SetWindowText(_T("text3"));

Hope it helps.
You need to be more specific in describing what you are trying to do.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900