TextBox help!....

D

Developer

VC++ 2005 Express Edition:

I have a textBox with the properties:

this->m_TextBox_Desc->Multiline = true;
this->m_TextBox_Desc->WordWrap = true;
this->m_TextBox_Desc->ScrollBars = ScrollBars::Vertical;

I read my database with a description for the user. I want to load each
line into a listView. With wordWrap and the Width of the textBox gives
me 4 lines, but when I use:

m_TextBox_Desc->Text = database[L"Description"]->ToString();
array<System::String^>^ tempArray = gcnew array<System::String^>(
m_TextBox_Desc->Lines->Length );
tempArray = this->m_TextBox_Scripture->Lines;

I only get 1 line, How come? In MFC VC++ you can use functions
GetLineCount() and GetLine(n, (LPTSTR)pszText, sizeof(pszText)). Where
are the line breaks in the textBox?

Thanks for your help!..
 
P

pvdg42

Developer said:
VC++ 2005 Express Edition:

I have a textBox with the properties:

this->m_TextBox_Desc->Multiline = true;
this->m_TextBox_Desc->WordWrap = true;
this->m_TextBox_Desc->ScrollBars = ScrollBars::Vertical;

I read my database with a description for the user. I want to load each
line into a listView. With wordWrap and the Width of the textBox gives me
4 lines, but when I use:

m_TextBox_Desc->Text = database[L"Description"]->ToString();
array<System::String^>^ tempArray = gcnew array<System::String^>(
m_TextBox_Desc->Lines->Length );
tempArray = this->m_TextBox_Scripture->Lines;

I only get 1 line, How come? In MFC VC++ you can use functions
GetLineCount() and GetLine(n, (LPTSTR)pszText, sizeof(pszText)). Where
are the line breaks in the textBox?

Thanks for your help!..

Your problem stems from the fact that you stored a single string in the text
property of your text box that *appears* to be broken into substrings
because of the WordWrap property setting.
If you entered multiple lines into your text box through your interface
like:
"one" <Enter>
"two" <Enter>, etc.
each line would be stored as a separate element in your array. This is true
because of the escape sequences placed in your entry when the <Enter> key is
struck.
OTOH, if you enter "OneTwoThreeFourFiveSixSevenEight" (etc.) through your
interface (even though the entry will *appear* to be broken up into multiple
lines in your text box, it is a single string and will be treated as such.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top