Solved

Multiline Edit Control

Posted on 2006-11-06
1
265 Views
Last Modified: 2010-04-01
Hi Experts,

I have a multiline edit control. When I load the dialog with the edit control, I want to

be able to initiliaze the text in the control so it will insert a line break where spaces occur

in the text. So SetDlgItemText(hWnd, IDC_EDIT, "This is a test"); should display in

the edit box as:

This
is
a
Test

I tried replacing the spaces with '\r' and '\n' characters to no effect.

How do I preformat a string so it will display on multiple lines in the edit control?

Thanks!

0
Comment
Question by:CPOsosky
1 Comment
 
LVL 86

Accepted Solution

by:
jkr earned 100 total points
ID: 17882899
>>How do I preformat a string so it will display on multiple lines in the edit control?

You need to use '\r\n', e.g.

SetDlgItemText(hWnd, IDC_EDIT, "This\r\nis\r\na\r\ntest");
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now