I have an edit box, with its settings as "multiline", "want return", and "vertical scroll."
All I want to do is to have new lines between each output line. However, I have tried "\n", which did not work. So, is there a way to make them have line breaks?

Recommended Answers

All 3 Replies

Mdos uses one character to represent a newline ascii character number 10.
Windows app's however use two characters to represent a newline, ascii characters numbers 13 and 10.

In a multline control to get a newline you have to use char(13) followed by char(10)

Hmm.... I tried this:

m_ChatText = "Hello!";
	MessageBox(m_ChatText);
	m_ChatText += char(13) + char(10);
	MessageBox(m_ChatText);
	m_ChatText += "How are you?";
         MessageBox(m_ChatText);

The output is:
Hello!
Hello!|-
Hello!|-How are you?

Carriage return, line feed does make sense but it isn't working, at least not how I am implementing it in the above.

So I tried using both escape sequences /r/n which does make a newline.

m_ChatText += char(13) + char(10); might not work as expected.
the compiler sees char(13) + char(10) like 13 + 10 = 23

So its like writing m_ChatText += char(23);

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.