how do I define a new line for edit box
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.
Re: how do I define a new line for edit box
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");
Re: how do I define a new line for edit box
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?
Re: how do I define a new line for edit box
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");
Re: how do I define a new line for edit box
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