?
Solved

Multiline Edit Control

Posted on 2006-11-06
1
Medium Priority
?
275 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 86

Accepted Solution

by:
jkr earned 400 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
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…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

718 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