Add multiline to ClistBox in MFC C++

BaritoneH
BaritoneH used Ask the Experts™
on
I know how to use ClistBox and AddString to add one line of string at a time.  However, is there a easy way to automatically add multiple lines to the list box if a string is embedded with "\n".

Example:

"First Line of Text \n Second Line \n  Third Line \n" in the Cstring

With MFC in C++, Is there a function that I can use to automatically parse this line into three lines and add three separate lines to the ClistBox.   Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
AndyAinscowFreelance programmer / Consultant
Commented:
Not easily - the list box is designed to display single lines of text.

You would need to have an owner draw listbox
Hi BaritoneH,

here you can find a class which implements a multiline CListBox (even with optional capability to edit entries): http://www.codeproject.com/KB/combobox/listboxxp.aspx

Hope that helps,

ZOPPO

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial