Click to See Complete Forum and Search --> : how do I define a new line for edit box


Danielle Harvey
May 12th, 1999, 09:52 AM
I have a multi-line edit box. Currently I type something like the following;

m_edit1 = "text, text, text";
UpdateData(FALSE);

and text appears in the edit box. I want to type alot of text though and when
I do that, it all appears on the first line only. How can I declare a new line in the
edit box?

When I type

m_edit1 = "text, text, text \n
newtext";

I get errors!

Any response anyone can give me will be greatly appreciated.

May 12th, 1999, 12:39 PM
Set properties of your edit control to multi-line in resource editor(or programmatically).
Use the sequence "\r\n".
F.i., pEdit->SetWindowText("First line\r\nSecond line\r\nThird line");

Danielle Harvey
May 12th, 1999, 03:25 PM
If I type,

m_edit1 -> SetWindowText("Firstline\r\nSecond line\r\n");

I get the error

'CString does not have an overloaded member operator ->'

Please, is there something I am doing wrong?

Dan Haddix
May 13th, 1999, 01:56 AM
The -> operator is only used when you have a pointer to an object. If your using a member variable you only need to use a period. Like so...

m_edit1.SetWindowText("Firstline\r\nSecond line\r\n");

chiuyan
May 13th, 1999, 11:06 AM
if m_edit1 is a CString in your code, it doesn't have the SetWindowText function either. Is m_edit1 the member vaiable you associated with your edit box? If so, you would probably do something like:
m_edit1 = "First\r\nSecond\r\n";
UpdateData (FALSE);

And make sure your editbox has the multiline property set.

--michael