tags:

views:

43

answers:

1

I have a binded ListBox that displays text. This text is coming from another multiline TextBox. Multiple lines are shown as first line□□second line in ListBox.

I want this text to be displayed as first line second line OR as first line in a ListBox row.

EDIT: I am actually trying to create a note taking application. The 'ListBox' will show a part of text and 'TextBox' will show the detailed text.

+1  A: 

If you check the string, returned via TextBoxt.Text with Multiline set to true, you will notice, that each line ends with "\r\n" sequence. So, depending on what you want, you can split the string from the TextBox using "\r\n" as the parameter in Split method and show these lines as different items in ListBox or replace the "\r\n" in the string with whitespace and show it as a single ListBox item.

26071986
Well, this is the problem. I must not alter the form of text. Means the text with return character must be saved as it is.Also why should i display a single text as multiple items in 'TextBox'. I am actually trying to create a note taking application. The 'ListBox' will show a part of text and 'TextBox' will show the detailed text.
LifeH2O
@LifeH2O Maybe, I didn't quite understand your question. If Split doesn't suite you, but you want to get rid of squares, then you can use Replace method - then you will get the full text without embarassing squares (though I tested this sitution just now and there were no squares).
26071986
If i replace, will it change the original text? I am gonna give it a try
LifeH2O
@LifeH2O You can try it in some test project. In my case everything was OK. One thing I didn't check - what if you print \r\n on purpose in the TextBox?
26071986