Solved

How to display multiple lines in a edit box at runtime?

Posted on 2001-07-11
2
231 Views
Last Modified: 2013-11-20
Hello everyone,

  I want to display multiple lines in a edit box at run time.

  What I did was as follows:
   szNewLine.Format("%s\n%s", szPrevLine, szLine);
   pEdit->SetWindowText(szNewLine);
  Instead of seeing two lines inside the edit box as I expected, I saw one line with a CR separating two strings. How can I implement multiple lines at run time as if the user hits enter within a multiple-lined edit box?

  Thanks.

Nancy



0
Comment
Question by:qwang73
[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
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 50 total points
ID: 6275223
You'll have to make sure that the edit field has the 'ES_MULTILINE' style set (you can check/set that in the resource editor). Furthermore, you'll have to use the correct linebreak:

  szNewLine.Format("%s\r\n%s", szPrevLine, szLine);
  pEdit->SetWindowText(szNewLine);

'\r\n' is what you'll need.


0
 

Author Comment

by:qwang73
ID: 6275331
jkr,

  Thanks for your answer and the note about duplicate question. '\r\n' is exactly what I need. Funny thing is that I tried to put 0x0A(LF) and 0x0D(CR) at the end and it didn't work. Is that the same as '\r\n'?

Nancy
0

Featured Post

Independent Software Vendors: 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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

724 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