views:

24

answers:

1

I have an app that has a multiline text box on it. This is data that comes from a client application elsewhere. There are different versions of the client app for different platforms, and furthermore these platforms have different default rules about line endings.

Thus, the data I want to show in the textbox might have CR+LF line endings, or might just have CR line endings.

How can I make the textbox show these carriage returns in either format? I don't see any property to do so and would prefer to not rewrite the data to change CR only to CR+LF (I want the data, if saved, to be written back out in the form it came in.)

+1  A: 

I think you would have to change the data, unless you're going to override the TextBox, and I think that changing the data would be the normal way to go about it. Text data sent between systems usually get converted, for example if you transfer via FTP in text mode it'll normally do it for you (at least any clients I've tried).

Also, if you don't convert the data and the user selects the text and pastes it in to another application that doesn't understand other line endings it might not look like he expects it and he might blame your application. And since you could do it with two simple Replace statements to replace back and forth if you do want to save in that format I'd suggest that that's the way to go.

ho1